Skip to content

Commit d61a12a

Browse files
zahashtshepang
authored andcommitted
1675 move 'failed to push some refs' into its own section
1 parent f83c46a commit d61a12a

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed

src/git.md

+18-16
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,24 @@ and just want to get a clean copy of the repository back, you can use `git reset
201201
git reset --hard master
202202
```
203203

204+
### failed to push some refs
205+
206+
`git push` will not work properly and say something like this:
207+
208+
```
209+
! [rejected] issue-xxxxx -> issue-xxxxx (non-fast-forward)
210+
error: failed to push some refs to 'https://github.com/username/rust.git'
211+
hint: Updates were rejected because the tip of your current branch is behind
212+
hint: its remote counterpart. Integrate the remote changes (e.g.
213+
hint: 'git pull ...') before pushing again.
214+
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
215+
```
216+
217+
The advice this gives is incorrect! Because of Rust's
218+
["no-merge" policy](#no-merge-policy) the merge commit created by `git pull`
219+
will not be allowed in the final PR, in addition to defeating the point of the
220+
rebase! Use `git push --force-with-lease` instead.
221+
204222
### Git is trying to rebase commits I didn't write?
205223

206224
If you see many commits in your rebase list, or merge commits, or commits by other people that you
@@ -306,22 +324,6 @@ Git know that you've resolved the conflicts and it should finish the rebase.
306324
Once the rebase has succeeded, you'll want to update the associated branch on
307325
your fork with `git push --force-with-lease`.
308326

309-
Note that `git push` will not work properly and say something like this:
310-
311-
```
312-
! [rejected] issue-xxxxx -> issue-xxxxx (non-fast-forward)
313-
error: failed to push some refs to 'https://github.com/username/rust.git'
314-
hint: Updates were rejected because the tip of your current branch is behind
315-
hint: its remote counterpart. Integrate the remote changes (e.g.
316-
hint: 'git pull ...') before pushing again.
317-
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
318-
```
319-
320-
The advice this gives is incorrect! Because of Rust's
321-
["no-merge" policy](#no-merge-policy) the merge commit created by `git pull`
322-
will not be allowed in the final PR, in addition to defeating the point of the
323-
rebase! Use `git push --force-with-lease` instead.
324-
325327
### Keeping things up to date
326328

327329
The above section on [Rebasing](#rebasing) is a specific

0 commit comments

Comments
 (0)