如下图这种 或以下这种
[rejected] master -> master (non-fast forward)
error: failed to push some refs to 'git@github.com:me/me.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'non-fast forward'
section of 'git push --help' for details.
解决办法 目前发现两种
第一种
使用git pull
在提交对象A和B之间创建合并提交对象C. 或者,使用git pull --rebase
在提交对象A之上重新定义X和B之间的更改,然后将结果推回。 rebase将创建一个新的提交对象D,它在A之上构建X和B之间的变化。
提交对象相关内容可参照juejin.cn/post/704888… 里的Git实现原理栏
第二种
通过在分支名称前添加+符号来强制推送
git push origin +branch