computer:program:git
Git
Commit
- Commit (message editor)
Branch
git branch --sort=committerdate
ASC
git branch --sort=-committerdate
DESC
Rebase
git rebase -i --root
git rebase COMMIT --exec 'git commit --amend --reset-author --no-edit'
Hooks
git config --global core.hooksPath ~/.git/hooks
pre-commit
Worktree
Notes
Tip
Log
Reset
git reset origin/master --hard
Rebase
git rebase -s recursive -X <ours/theirs> master
git rebase --onto newbase upstream branch
Stash
- Show diff in git stash
git stash show -u
Branch
- Quick Switch Between Git Branches
git checkout -
git merge branch --no-commit --no-ff
Filter Branch
-
git filter-branch --index-filter "git rm -r -f --cached --ignore-unmatch TARGET" --prune-empty HEAD
也可加上 -q 抑制輸出,-f 強制把暫存區的備份清掉
Patch
git format-patch --no-prefix HEAD^
Diff
Blame
git blame --ignore-revs-file
Subtree
git subtree push --prefix dist origin gh-pages
Ignore
git config --global core.excludesfile ~/.gitignore echo .DS_Store >> ~/.gitignore
Alias
Command
git commit --amend –C @
git checkout -- .
git rm --cached
git reflog
git shortlog
git fsck --no-reflogs
git update-index --assume-unchanged
git ls-files -o --directory --exclude-standard
git config --global user.name "Firstname Lastname" git config --global user.email "your_email@youremail.com"
git config --global color.diff auto git config --global color.status auto git config --global color.branch auto git config --global color.log auto
git config --global color.ui true
git config --global core.editor micro
git config --global alias.timeline "log --oneline --graph --decorate" git timeline
資源
Github
Pull Request
Tool
Service
Client
書籍
教學
工具
Hosting
rubygem
npm
grunt
介面
TUI
GUI
computer/program/git.txt · 上一次變更: 2025/06/24 07:36 由 wm
