Git 實用指令
Git 實用指令
GUI
gitk --allnpm install ungit -g查看特定檔案的修改紀錄
gitk --follow [filename]取消git add .
git reset刪除遠端分支
git push origin :the_remote_branch
或是
git push origin --delete the_remote_branch移除本地分支
git branch -D <分支名稱>移除遠端的目錄(不包含本地)
將一個分支的所有內容推送到另一分支
有時在遠端開分之後新增檔案但和local端history不同,導致無法pull和push
移除遠端上一次的push
取消上次commit且維持檔案內容
取消 branch 初次 commit 且維持檔案內容
回到上次commit的檔案狀態,刪除檔案內容
回到上次commit檔案狀態,刪除檔案內容,但把檔案內容先儲存
把別人遠端新開的分支fetch到你的電腦
使用 Git rebase 讓 Git Pull 時避免auto merge commit
使用 Git rebase 來 squash commit
如果出現 cannot 'fixup' without a previous commit
cannot 'fixup' without a previous commit
把最新的master內容更新到feature branch
有關submodule
git Subtree
修改上一次commit 的說明
修改以前多次commit 說明
移除以前的commit
重置歷史commit
移除所有Commit 紀錄
Git Reset
Git Reflog
移除 reflog 內的紀錄
ORIG_HEAD
Git cherry-pick
Git revert
Git Rebase
Git Blame ./filename
Git format-patch(打包以前的commit)
Git shallow glone
假設最新的不再master branch 在其他HEAD(ex: bc50ed4)但想把master更新為bc50ed4
.gitignore沒反應
查看目前修改過但還沒add的檔案
查看目前已add 但還沒commit的檔案
查看目前已commit還沒push的檔案
取消Rebase
Checkout 先前 commit 後 merge
回復以前commit的內容,並覆蓋develop
一次解決所有 conflict
快速更改上次commit的作者
直接給予權限
改大小寫後push確沒改到
把某個pull request直接加到local
Merge時省略特定檔案

創建空的branch
GIt commit 後只有一個檔案
Git 自訂快捷鍵
Git bundle
單獨更新特定資料夾的檔案到本地
從 master build 完推送 build folder 到 gh-pages
Git tag

將其他 repo 的 commit cherry pick 進來
使用特定 ssh key 來執行 git 指令
部署的時候使用 access token

其他不錯文章
Last updated
