在使用git提交代码时会出现error: failed to push some refs to 'xxxx的错误
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
原来使用的提交命令是git push -u origin 分支名
不妨尝试一下使用覆盖提交的方式
git push -f origin 分支名
其中“-f”是覆盖提交的参数。
大致意思是要先拉一下代码,再推一次代码,拉代码使用git push
先命令:git pull
后命令:git push
git pull origin master --allow-unrelated-histories
git commit -m 'xx'