`git config --global --edit` ``` [alias] # Command shortcuts ci = commit co = checkout st = status # Display tree-like log, because default log is a pain… lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%C(bold blue)<%an>%Creset' --abbrev-commit # Rebase current branch from master sync = !git checkout main && git pull && git checkout - && git rebase main # Useful when you have to update your last commit # with staged files without editing the commit message. oops = commit --amend --no-edit # Ensure that force-pushing won't lose someone else's work (only mine). push-with-lease = push --force-with-lease # Rebase won't trigger hooks on each "replayed" commit. # This is an ugly hack that will replay each commit during rebase with the # standard `commit` command which will trigger hooks. rebase-with-hooks = rebase -x 'git reset --soft HEAD~1 && git commit -C HEAD@{1}' # List local commits that were not pushed to remote repository review-local = "!git lg @{push}.." # Edit last commit message reword = commit --amend # Undo last commit but keep changed files in stage uncommit = reset --soft HEAD~1 ```