Skip to content

Instantly share code, notes, and snippets.

@ravicious
Last active December 15, 2017 12:08
Show Gist options
  • Save ravicious/c07a8f7d53881a6f6a20ee60301c2cfc to your computer and use it in GitHub Desktop.
Save ravicious/c07a8f7d53881a6f6a20ee60301c2cfc to your computer and use it in GitHub Desktop.
[alias]
# Undoes last commit and leaves the files commited by it in the staging area.
undo-commit = reset --soft HEAD^
today = !git log --since=midnight --author=\"$(git config user.name)\" --color --graph --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr)%Creset' --abbrev-commit
yesterday = !git log --since="yesterday.midnight" --until=midnight --author=\"$(git config user.name)\" --color --graph --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr)%Creset' --abbrev-commit
# More succint version of `git status`.
st = status -sb
# It takes ages to type `rebase --continue`.
rc = rebase --continue
# My preffered version of `git log`.
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
co = checkout
com = checkout master
# Cool alias if you use autosquashing a lot.
ria = rebase -i --autosquash
# Needed for the alias in .zshrc.
root = rev-parse --show-toplevel
# Removes the branch locally and on the `origin` remote.
remove-branch = "!f(){ git branch -d ${1}; git push origin --delete ${1}; };f"
# For merging branches in repos which use merge commits.
mfe = merge --no-ff --no-edit
# For merging branches in repos which doesn't use merge commits.
mff = merge --ff-only
# Jump to the root directory of the current repo.
alias gcd='cd $(git root)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment