git push origin master
An error occurred.
error: failed to push some refs to 'git+ssh://git@github.com/yufeiluo/newstart.git'
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.
I solved it this way,
git push -f origin master
Now I want to use the prompt method to solve it
You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
If all git pulls come back, won’t the local ones be overwritten?
I am a newbie, please give me some advice
1. If the local branch and the remote branch can be automatically merged, you can directly
commit
,然后push这样就可以了2.如果不一样就需要先
git pull
,但是这个命令会自动合并分支,可以使用git fetch
,然后手动合并然后git push
It is not recommended to use it directly
git push -f
,强制push可能会覆盖别人的修改,使用git pull
It will not overwrite local modifications. If they can be merged together, they will be merged together. Just add/commit/push again. If there is a conflict, resolve the conflict and continue submitting.