2016年8月25日 星期四

Git筆記:gitignore

通常在一般的專案中一定會有引用Library的時候, 但通常這些library伊多, 就會造成整個資料夾過肥, 但這些檔案都是可以透過使用者在本地端下載即可, 所以在這時就可以使用.gitignore來將不需要上傳的檔案留在原地.

iOS的部分可以參考以下網址:
1.Objective-C.gitignore
https://github.com/github/gitignore/blob/master/Objective-C.gitignore
2.Stack
http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
3.Gitignore產生器
https://www.gitignore.io/
4.一些程式語言的參考
https://github.com/github/gitignore

SourceTree

可以手動加入.
enter image description here

手動新增.gitignore

利用VIM新增檔案即可.

PUSH後才新增時

會發現.gitignore沒有作用, 原因是因為.ignore是後來加進來的 local cache裡面記錄的這個文件是不會忽略的, 所以需要進行緩存清除

$ git rm --cached iLedger.xcodeproj/project.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate
$ git commit -m "Removed the stupid strange file that shouldn't be tracked"
$ git push