2017年10月10日 星期二

git pull --rebase 的前置作業


  1. git commit -m "..." #確定 staging area 清空
  2. git log 找出上次 checkout 的版本
  3. git diff 版本號 #確定 diff 的內容可以接受,沒有不需要的檔案、目錄,不然merge會很久
  4. git remote -v #確定 remote repository 的名稱
  5. git pull --rebase repo名 branch名 
  6. 中間會有需要手動解決的情況,編輯該檔案,並記得 git add 該檔案,接著下 git rebase --continue (或skip),事後要確認檔案內容

 在 local repo 中移除特定目錄


比較特別的是要在 local repo 中移除特定目錄,但保留在 working dir 當中,參考此帖

簡言之就是:

git rm -r --cached 目錄名

並請記得在 .gitignore 中加入對應的一行,以斜線"/"結尾,這樣才能順利 commit