- 查看分支/目前分支git branch
- 新增分支git branch <分支名稱>
- 刪除分支git branch -d <分支名稱>
- 切換分支git checkout <分支名稱>
- 拉取origin分支資料,等同於執行git fetch + gti merge 目前的分支git pull
- 推送分支到遠端, ex.git push origin leohuanggit push <數據庫簡稱> <分支名稱>
- 合併分支git merge <分支名稱>
- 查看提交紀錄git log
- 查看目前檔案狀態git staus
- 單一檔案加入索引git add <檔案名稱>
- 全部加入索引git add -Agit add -all
- 提交紀錄git commit -m "<填寫版本更新資訊>"
- 合併提交, 將第二行的 "pick" 改為 "squash",儲存後並退出git rebase -i HEAD~~
- 查看圖形多分支顯示的提交紀錄指令git log --all --graph --decorate --oneline
- 註冊縮短指令git config --global alias.<自訂命令> <原始命令>
- 縮短checkoutgit config alias.co checkout
- 縮短branchgit config alias.br branch
- 縮短commitgit config alias.ci commit
- 縮短stasusgit config alias.st status
- 縮短美化後的git log樣式(斷行是為了文章方便閱讀,實際上不能斷行)git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset-%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
Git常用指令
-
刪除圖檔.bat 之前把伺服器的資料全部抓下來,但是會有很多多餘的檔案,導致搜尋時需要花很多時間,所以寫了這個檔案將不必要的附檔名的資料都刪除掉。 ::%cd% => 當前目錄 ::/S 遞迴子目錄 ::Del 刪除檔案 Del %cd% \新資料夾\*.20* /S ...
-
因為老是記不起來hosts放在哪裡,雖然Windows已經放在桌面上很好存取,但是連線到LINUX主機時又要再找一次,所以特別記錄位置 Windows C:\\Windows\system32\drivers\etc\hosts Linux \etc\hosts