2

按照 git 命令行的说明陷入 git 无限循环。如果我已经是最新的,为什么我不能推送。它要求我拉。所以我拉。我已经是最新的了。我需要推我的东西。

$ git push
trace: built-in: git 'push'
trace: run_command: 'ssh' 'git@somewhere' 'git-receive-pack '\''rt.git'\'''
Enter passphrase for key '/blah/blah':
To git@somewhere:rt.git
 ! [rejected]        BRANCH-1600 -> BRANCH-1600 (non-fast-forward)
 ! [rejected]        release_1.0.1 -> release_1.0.1 (non-fast-forward)
error: failed to push some refs to 'git@somewhere:rt.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.


$ git pull
trace: exec: 'git-pull'
trace: run_command: 'git-pull'
trace: built-in: git 'rev-parse' '--git-dir'
trace: built-in: git 'rev-parse' '--is-bare-repository'
trace: built-in: git 'rev-parse' '--show-toplevel'
trace: built-in: git 'ls-files' '-u'
trace: built-in: git 'symbolic-ref' '-q' 'HEAD'
trace: built-in: git 'config' '--bool' 'branch.BRANCH-1600.rebase'
trace: built-in: git 'config' '--bool' 'pull.rebase'
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
trace: built-in: git 'fetch' '--update-head-ok'
trace: run_command: 'ssh' 'git@somewhere' 'git-upload-pack '\''rt.git'\'''
Enter passphrase for key '/home/achen/.ssh/id_rsa':
trace: run_command: 'rev-list' '--verify-objects' '--stdin' '--not' '--all' '--quiet'
trace: run_command: 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
trace: exec: 'git' 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
trace: built-in: git 'rev-list' '--verify-objects' '--stdin' '--not' '--all'
trace: built-in: git 'rev-parse' '-q' '--verify' 'HEAD'
trace: built-in: git 'fmt-merge-msg'
trace: built-in: git 'merge' 'Merge branch '\''rel_3.6.0'\'' of somewhere:rt into RTDE                                                 V-1600' 'HEAD' '6ba69b1fc5973ecbc5cef61a3846a901ca82c17a'
Already up-to-date.
4

1 回答 1

0

尝试

$ git co BRANCH-1600
$ git pull
$ git push

release_1.0.1分支一样。

或者您可以先在远程仓库中删除BRANCH-1600和分支。release_1.0.1

$ git push :BRANCH-1600
$ git push :release_1.0.1
$ git push -u origin BRANCH-1600
$ git push -u origin release_1.0.1

我猜您已经回滚了一些提交(或使用--amendarg 提交),但您之前已经将它们推送到远程仓库。

如果您确定本地分支的来源是正确的,只需使用-farg 将其强制推送到远程:

$ git push -f origin BRANCH-1600
$ git push -f origin release_1.0.1
于 2012-11-27T01:41:49.353 回答