如题,dev,master两个分支,将dev变基到master上,然后dev再去add,commit,push,会报如下错
`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 push -f则会成功提交,且提交线变成一条
git-push
当远程分支的提交不是本地分支的提交的祖先的时候,git-push 会失败。
变基(git-rebase)会改变提交的之间的祖先关系。从而造成上述情况。
--force
会强制提交,会导致远程仓库丢失提交。比如:
这时,远程的 origin/dev 的提交是 E ,本地在 E' ,E 并不是 E' 的祖先,于是提交失败。