通常情况下,我只是运行
git add file
git commit
git push
但如果我在推送之前通过git commit --amend
修改提交的内容,则下一次推送将失败。
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
我该如何让 git 推送更改而不合并分支?我只有一个分支 (master
),而且我是唯一使用此仓库的人,那么为什么它会显示这个消息?
git branch -a:
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master
编辑:使用gitk HEAD @{u}
,我发现我有2个分支,一个包含原始提交,另一个包含修改后的提交。
git add file
git commit -m "something"
git commit -m "something else"
可以正常工作 - Sagar Sakregit branch -a
的输出是什么? - Sagar Sakre