You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Project Overview
4
4
5
-
`git-rain` is a standalone Go CLI that syncs local git repositories _from_ their remotes — the reverse of `git-fire`. It is extracted from the `git-fire` codebase and promoted to a first-class tool.
5
+
`git-rain` is a standalone Go CLI for pulling remote state back down — the reverse of `git-fire`. By default it **fetches mainline remote-tracking refs** after scanning; **`--sync`** runs full local branch hydration (fast-forward / safe skip / risky reset). It is extracted from the `git-fire` codebase and promoted to a first-class tool.
6
6
7
7
Module: `github.com/git-rain/git-rain`
8
8
Go version: 1.24.2
@@ -48,10 +48,12 @@ main.go
48
48
49
49
**Key design decisions:**
50
50
- Uses native `git` binary via `exec.Command` — not go-git.
51
+
- Default run: `internal/git.MainlineFetchRemotes` (targeted `git fetch` per remote for mainline branches). Full hydrate: `RainRepository` when `--sync`, non-mainline `branch_mode`, or risky mode is active.
Copy file name to clipboardExpand all lines: README.md
+32-25Lines changed: 32 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,10 +15,10 @@
15
15
16
16
```
17
17
git-fire → commit + push everything out
18
-
git-rain → pull everything back down
18
+
git-rain → fetch (default) or full reverse sync with --sync
19
19
```
20
20
21
-
`git-rain` discovers all your local git repositories and syncs them from their remotes in one command — fast-forwarding branches, updating non-checked-out refs, and skipping anything that would rewrite local-only commits (unless you ask it to).
21
+
`git-rain` discovers git repositories under your scan path (and known registry entries), then by default **fetches mainline remote-tracking refs** only (`main`, `master`, `trunk`, `develop`, `dev`, gitflow prefixes, plus your configured patterns). Use **`--sync`** for full hydration: fast-forwarding branches, updating non-checked-out refs, and skipping anything that would rewrite local-only commits unless you enable risky mode.
22
22
23
23
Invocation note: `git-rain` and `git rain` are equivalent when `git-rain` is on your PATH.
24
24
@@ -39,7 +39,7 @@ Invocation note: `git-rain` and `git rain` are equivalent when `git-rain` is on
39
39
-[Core Commands](#core-commands)
40
40
-[Flags](#flags)
41
41
-[Configuration](#configuration)
42
-
-[TUI Selector](#tui-selector)
42
+
-[Interactive TUI](#interactive-tui)
43
43
-[Safe Mode vs Risky Mode](#safe-mode-vs-risky-mode)
44
44
-[Registry](#registry)
45
45
-[Security Notes](#security-notes)
@@ -52,11 +52,14 @@ Invocation note: `git-rain` and `git rain` are equivalent when `git-rain` is on
52
52
# preview first — shows what would be synced without touching anything
53
53
git-rain --dry-run
54
54
55
-
#sync all repos under the configured scan path
55
+
#default: scan repos, then fetch mainline remote-tracking refs from remotes
56
56
git-rain
57
57
58
-
# interactive TUI: pick exactly which repos to sync
59
-
git-rain --select
58
+
# full local branch sync (same safety/risky rules as before)
59
+
git-rain --sync
60
+
61
+
# interactive TUI: pick repos, then default fetch or --sync behavior
62
+
git-rain --rain
60
63
```
61
64
62
65
## Install
@@ -151,38 +154,41 @@ Requires Go 1.24.2+.
151
154
152
155
## How It Works
153
156
154
-
1.**Scan** — walks your configured scan path discovering git repositories
155
-
2.**Fetch** — runs `git fetch --all --prune` for each repo
156
-
3.**Sync** — for each local branch with a tracked upstream:
157
+
1.**Scan** — walks your configured scan path and includes known registry repos (`--no-scan` limits to registry only)
158
+
2.**Default: mainline fetch** — for each repo, runs targeted `git fetch <remote> --prune` for mainline branches so `origin/main` (etc.) advance; **local branch refs are not moved**
159
+
3.**With `--sync` (or non-mainline `branch_mode` in config, or `--risky`)** — full hydrate: runs `git fetch --all --prune` (optional `--tags`), then for each eligible local branch with a tracked upstream:
157
160
- If the branch can be fast-forwarded: updates it
158
161
- If the branch has local-only commits: skips (safe mode) or backs up and resets (risky mode)
159
162
- If the working tree is dirty on the checked-out branch: skips
`git-rain --select` opens an interactive selector. Repositories stream in as the filesystem scan finds them — no waiting for the full scan to complete before you can start picking.
260
+
`git-rain --rain` opens an interactive picker. Repositories stream in as the filesystem scan finds them — no waiting for the full scan to complete before you can start picking. After you confirm, the tool runs the **default mainline fetch** unless you also passed **`--sync`** (or config implies full sync).
254
261
255
262
**Key bindings:**
256
263
257
264
| Key | Action |
258
265
|---|---|
259
266
|`space`| Toggle repo selection |
260
267
|`a`| Select all / deselect all |
261
-
|`enter`| Confirm selection and begin sync |
268
+
|`enter`| Confirm selection and begin fetch or sync |
0 commit comments