Skip to content

Instantly share code, notes, and snippets.

@gioragutt
Last active March 19, 2018 01:14
Show Gist options
  • Save gioragutt/12f402c1bcd06edb6a8122ace3ce57ef to your computer and use it in GitHub Desktop.
Save gioragutt/12f402c1bcd06edb6a8122ace3ce57ef to your computer and use it in GitHub Desktop.
Git Presentation
[alias]
graph = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%cr)%C(reset) %C(white) %s%C(reset) %C(bold yellow)- %cn%C(reset)%C(bold red)%d%C(reset)' --all
pr = pull --rebase
ob = checkout -b
amend = commit --amend
qam = commit --amend --no-verify --no-edit
tmp = commit --no-verify -m
far-master = !git fetch && git checkout -f master && git reset --hard origin/master
# Quickly amend a commit
git commit --amend --no-edit [--no-verify]
# Temporary commit
git commit --no-verify -m
# Delete local branches that were merged into master
git branch --merged master --no-color | grep -v master | xargs git branch -d (prune-local)
# Updates a local branch to be up to date without checking it out
git fetch origin <branch>:<branch>
# --name-only flag for summery of file names that changed in a commit
git log --name-only
git diff --name-only
# Rebase, while rebasing local merge commits as well
git pull --rebase=reserve
# Copies a commit on top of your HEAD
git cherry-pick <commit>
# Partial/Patch command
git commit/checkout/add/reset/stash -p
# Take absolute control of your branch
git rebase -i
# Create alias (vim ~/.gitconfig)
git config alias.<command> <alias>
# Stash only unstaged files
git stash save --keep-index
# Show diff, ignoring whitespaces
git diff -w
# Creates a new branch, with changes from stash||(top stash)
git stash branch [stash]
# Stash untracked files as well
git stash save -u
# Find what person you want to scream at
git blame
# Ctrl+Z for git
git reflog
# Shows local branch very verbosely
git branch -vv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment