鍍金池/ 問答/PHP  Linux  HTML/ git push => error: failed to push som

git push => error: failed to push some refs to

1.正常 git pull 更新項目 修改 提交 推送的時候報錯
refs/heads/feature-activity affafce3303eca7d3efa75c9e7be516a6807865c refs/heads/feature-activity 067412f9c6c59c1772209c2872bcc7a4a03cf96c
推送失敗,請檢查: git status
error: failed to push some refs to 'git@XXXXXXXXXX/tryitzone.git'
2.百度搜索眾多解決方案 未果
3.思考之后 懷疑可能是本地commit id和正式庫commit id 不一致導致 提交失敗
4.查看git 命令發(fā)現(xiàn) git fetch ;git pull 區(qū)別
5.解決:

使用git fetch更新 然后git pull =>  修改 =>  git add .  =>  git commit =>  git  push  可以正常提交了
git fetch 從遠程獲取最新版本到本地,不會自動merge 會更新本地的commit id變成最新的commit id
git pull 從遠程獲取最新版本并merge到本地 會將本地庫更新成遠程庫的最新狀態(tài) 不會更新本地的commit id
git pull = git fetch + merge to local

基礎不扎實 (?﹏?)

回答
編輯回答
臭榴蓮

那你都知道了還在問什么...

2017年9月11日 21:31