Commit 19ac52a
committed
fix(repository): replace Pull with Fetch+Reset to avoid go-git non-fast-forward bug
The go-git library's Pull() function has a known issue (#358) where it
returns 'non-fast-forward update' errors even when a fast-forward merge
is possible. This happens when local branches don't have proper upstream
tracking configured.
This commit replaces Pull() with an explicit Fetch() + Hard Reset approach:
1. Fetch latest changes from remote with Force=true
2. Get the remote reference for the target branch
3. Hard reset the worktree to the remote ref
4. Update the local branch reference
This approach:
- Avoids the go-git Pull() bug entirely
- Is more explicit about what we want (always match remote)
- Handles force-push scenarios correctly
- Works regardless of tracking configuration
Fixes: go-git/go-git#3581 parent 05349b5 commit 19ac52a
1 file changed
+28
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
131 | | - | |
132 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
135 | 141 | | |
136 | 142 | | |
137 | | - | |
138 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
139 | 146 | | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
150 | 164 | | |
151 | 165 | | |
152 | 166 | | |
| |||
0 commit comments