資訊人筆記

Work hard, Have fun, Make history!

使用者工具

網站工具


tool:git_command簡介

git command簡介

.gitignore

  • 設定要求 git 忽略的檔案或資料夾
  • 規則如下
    • 空白列或者以#開頭的列會被忽略
    • 可使用標準的Glob pattern
    • 可以/結尾,代表是目錄
    • 可使用 ! 符號將特徵反過來使用
  • 將 .gitignore 放在與 .git 同層級的目錄底下
  • .gitignore 無法處理已經開始被 git 追蹤的檔案
    • 使用 git rm --cached file 將文件退出 git 追蹤再加入 .gitignore

復原已被更動的檔案

  $ git checkout -- filename

取消追蹤遠端分支

  $ git branch -d -r origin/<remote branch name>
tool/git_command簡介.txt · 上一次變更: 127.0.0.1