Git Config
Git commands can be long, the following instructions will show you how to make them short. For bash git completion, check out instructions.
Now you could do:
• git lol
instead of git log --graph --decorate --pretty=oneline --abbrev-commit
• git co
instead of git checkout
Instructions
Download my
.gitconfig
gist.or
Create a .gitconfig file in your home directory.
~/.gitconfig
and copy the following text.Note: Make sure to change
name
andemail
[user] name = Joe Buza email = [email protected] [color] ui = auto [color "branch"] current = yellow reverse local = yellow remote = green [color "diff"] meta = yellow bold frag = magenta bold old = red bold new = green bold [color "status"] added = yellow changed = green untracked = cyan [alias] cmt = commit cam = commit -am st = status br = branch co = checkout df = diff dc = diff --cached lg = log-p lol = log --graph --decorate --pretty=oneline --abbrev-commit lola = log --graph --decorate --pretty=oneline --abbrev-commit --all ls = ls-files please = push --force-with-lease undo = reset --soft HEAD^ recommit = commit -a -c ORIG_HEAD commend = commit --amend --no-edit stsh = stash --keep-index staash = stash --include-untracked staaash = stash --all shorty = status --short -- merc = merge --no-ff br-ac = branch --sort=committerdate br-desc = branch --sort=-committerdate stash-untracked = "!f() { \ git stash; \ git stash -u; \ git stash pop stash@{1}; \ }; f" tags = log --tags --simplify-by-decoration --pretty="format:%ci %d" ign = ls-files -o -i --exclude-standard pr = "!f() { git fetch -fu ${2:-upstream} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f" pr-clean = "!git checkout master ; git for-each-ref refs/heads/pr/* --format=\"%(refname)\" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done" [push] default = matching [filter "media"] clean = git-media-clean %f smudge = git-media-smudge %f [commit] template = ~/.git-commit-template.txt [core] editor = vim [fetch] prune = true
Copy our git commit template to your home directory or run the following command:
curl https://gist.githubusercontent.com/Linell/bd8100c4e04348c7966d/raw/37c1f07f864587a01eb051dc38264267f4a840df/.git-commit-template.txt >> ~/.git-commit-template.txt
git config --global commit.template ~/.git-commit-template.txt
Note: Make sure your template path corresponds with the one in your .gitconfig
:
[commit]
template = ~.git-commit-template.txt