git push origin master
出現(xiàn)報(bào)錯(cuò)。
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.
我這樣解決了,
git push -f origin master
現(xiàn)在想用提示的方法解決
You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
如果全部git pull回來(lái),那不就把本地的覆蓋了?
我是新手,賜教
業(yè)精于勤,荒于嬉;行成于思,毀于隨。
1.如果是本地分支和遠(yuǎn)程分支可以自動(dòng)合并這個(gè)時(shí)候可以直接commit
,然后push這樣就可以了
2.如果不一樣就需要先git pull
,但是這個(gè)命令會(huì)自動(dòng)合并分支,可以使用git fetch
,然后手動(dòng)合并然后git push
不建議直接使用git push -f
,強(qiáng)制push可能會(huì)覆蓋別人的修改,使用git pull
并不會(huì)覆蓋本地修改,如果可以merge到一起則會(huì)merge到一起,只要重新add/commit/push即可,如果有沖突的話,解決沖突就可以繼續(xù)提交了。