From 5b12aab37497cb7bfb85ca6cb45f033f9b8d53d4 Mon Sep 17 00:00:00 2001 From: Jannik ZANDER Date: Mon, 2 May 2016 21:28:30 +0200 Subject: [PATCH] Add pretty git branch graph --- .gitconfig | 144 +++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 8 +-- 2 files changed, 145 insertions(+), 7 deletions(-) create mode 100644 .gitconfig diff --git a/.gitconfig b/.gitconfig new file mode 100644 index 0000000..ff5b146 --- /dev/null +++ b/.gitconfig @@ -0,0 +1,144 @@ +[alias] + # View abbreviated SHA, description, and history graphs + lg = !"git lg1" + lg1 = !"git lg1-specific --all" + lg2 = !"git lg2-specific --all" + lg3 = !"git lg3-specific --all" + + lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' + lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' + lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)' + + # View the current working tree status using the short format + s = status -s + + # Show the diff between the latest commit and the current state + d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" + + # `git di $number` shows the diff between the state `$number` revisions ago and the current state + di = !"d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d" + diffall = !sh git-diffall.sh + + # Pull in remote changes for the current repository and all its submodules + p = !"git pull; git submodule foreach git pull origin master" + + # Clone a repository including all submodules + c = clone --recursive + + # Commit all changes + ca = !git add -A && git commit -av + + # Switch to a branch, creating it if necessary + go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" + + # Show verbose output about tags, branches or remotes + tags = tag -l + branches = branch -a + remotes = remote -v + bra = branch -a + brd = branch -d + + # Amend the currently staged files to the latest commit + amend = commit --amend --reuse-message=HEAD + + # Credit an author on the latest commit + credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f" + + # Interactive rebase with the given number of latest commits + reb = "!r() { git rebase -i HEAD~$1; }; r" + + # Find branches containing commit + fb = "!f() { git branch -a --contains $1; }; f" + + # Find tags containing commit + ft = "!f() { git describe --always --contains $1; }; f" + + # Find commits by source code + fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f" + + # Find commits by commit message + fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f" + + # Remove branches that have already been merged with master + # a.k.a. ‘delete merged’ + dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" + + # List contributors with number of commits + contributors = shortlog --summary --numbered + + co = checkout + cobr = checkout -b + + root = rev-parse --show-toplevel + +[apply] + # Detect whitespace errors when applying a patch + whitespace = fix + +[init] + templatedir = ~/.git_template + +[repo] + reference = ~/gitcache + +[core] + # Use custom `.gitignore` and `.gitattributes` + excludesfile = ~/.gitignore_global + + # excludesfile = /proj/imt2000/ProSim/GIT/prosim_tools/.gitignore_global + attributesfile = ~/.gitattributes + + # Treat spaces before tabs and all kinds of trailing whitespace as an error + # [default] trailing-space: looks for spaces at the end of a line + # [default] space-before-tab: looks for spaces before tabs at the beginning of a line + whitespace = space-before-tab,-indent-with-non-tab,trailing-space + + # utocrlf = input + editor = git-editor.sh + +[color] + # Use colors in Git commands that are capable of colored output when + # outputting to the terminal. (This is the default setting in Git = 1.8.4.) + ui = auto + +[color "branch"] + current = yellow reverse + local = yellow + remote = green + +[color "diff"] + meta = yellow bold + frag = magenta bold # line info + old = red # deletions + new = green # additions + +[color "status"] + added = yellow + changed = green + untracked = cyan + +[help] + # Automatically correct and execute mistyped commands + autocorrect = 1 + +[diff] + tool = git-difftool + # Detect copies as well as renames + renames = copies + prompt = false + +[difftool "git-difftool"] + cmd = git-difftool.sh $LOCAL $REMOTE + +[merge] + tool = git-mergetool + # Include summaries of merged commits in newly created merge commit messages + log = true + prompt = false + +[mergetool "git-mergetool"] + cmd = git-mergetool.sh $LOCAL $REMOTE $BASE $MERGED + +[include] + # Local/private config goes in the include + path = ~/.gitconfig_local diff --git a/README.md b/README.md index ce6db15..5b42f27 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,7 @@ What you need to do on the new box is this: $ cd $HOME $ git init -<<<<<<< HEAD - $ git remote add home https://github.com/jannikz/home.git - $ git fetch home master - $ git reset --hard home/master -======= $ git remote add origin https://github.com/jannikz/dotfiles.git - $ git branch -u origin/master $ git fetch origin master $ git reset --hard origin/master ->>>>>>> db69933... Change repository name from home to dotfiles + $ git branch -u origin/master -- 2.43.0