git 學習之恢復本地刪除文件

刪除本地文件後,想從遠程倉庫中從新Pull最新版文件。

Git提示:up-to-date,但未得到刪除的文件

原因:當前本地庫處於另一個分支中,需將本分支發Head重置至master.

git checkout master 
git reset --hard
  • 1
  • 2

git 強行pull並覆蓋本地文件

git fetch --all  
git reset --hard origin/master 
git pull
  • 1
  • 2
  • 3

參考資料
1.Why does Git say my master branch is “already up to date” even though it is not?
2. why-does-git-say-my-master-branch-is-already-up-to-date-even-though-it-is-not

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