repo sync出現contains uncommitted changes錯誤解決辦法

repo sync出現contains uncommitted changes錯誤解決辦法

 

 

出現這個問題的原因是本地代碼發生變化,但未commit.

總思路:

將本地代碼回退發生變化之前,然後重新拉取遠程倉庫代碼。

解決:

  1. 進入發生 contains uncommitted changes 的路徑下
  2. 使用git status 查看commit

# Your branch and 'origin/msm8937_o1' have diverged,

# and have 1 and 4 different commit(s) each, respectively.

說明存在分支衝突,

  1. git cherry origin/msm8937_o1 查看哪個commit 衝突
  2. 使用git reset –hard <commit ID>恢復所有變化的文件。可以多回退幾個。
  3. 回到根目錄,repo sync

 

以下爲其他網友的解決方式:

1)repo forall -c "git reset --hard && git clean -fd && git pull"//全部回退一個版本,重新pull 不建議。

使用git reset --hard 回退到commit未發生變化之前

git clean --fd 清除變化的文件,刪除變化記錄目錄

git pull 重新pull代碼

參考:https://blog.csdn.net/u012637313/article/details/48028161

2)試着通過 git reset --hard來恢復所有變化的文件之後,依然存在上述問題,

最後通過cd .repo/manifests 切換到 .repo/manifests目錄下執行git stash命令,並通過git clean -f -d命令刪除變化記錄目錄,然後使用repo sync就可以通過了。

參考:https://blog.csdn.net/rig622/article/details/8027182

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章