Last active
December 19, 2025 16:19
-
-
Save brentk/943057a2d127f4e2671dc33d68496f82 to your computer and use it in GitHub Desktop.
My gitconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [user] | |
| name = brentk | |
| email = brenttkelly@gmail.com | |
| [push] | |
| default = simple | |
| [color] | |
| ui = auto | |
| [color "branch"] | |
| current = yellow reverse | |
| local = yellow | |
| remote = green | |
| [color "diff"] | |
| meta = yellow bold | |
| frag = magenta bold | |
| old = red bold | |
| new = blue bold | |
| [color "status"] | |
| added = yellow | |
| changed = green | |
| untracked = cyan | |
| [alias] | |
| # Common typos | |
| idff = diff | |
| dff = diff | |
| tdiff = diff | |
| # Quick shortcuts | |
| st = status | |
| br = branch | |
| # Diff current branch with master | |
| mdiff = diff master | |
| # List files different from master with +++/--- summary of changes | |
| # `git names` will diff against master by default; `git names Foo` will diff against Foo branch | |
| names = "!f(){ if [ $# -eq 0 ]; then git mdiff --stat=$(tput cols); else git diff $1 --stat=$(tput cols); fi };f" | |
| # List commit history with file changed in each commit ( with +++/--- summary of changes) | |
| lognames = "!f(){ git log \"$@\" --stat=$(tput cols); }; f" | |
| #lognames = "!f(){ git log --stat=$(tput cols) ;};f" | |
| #lognames = log --name-only | |
| # Show my commits | |
| logme = log --author=brent | |
| # Don't remember what this was, maybe list tags? | |
| tagcommit = rev-list -n 1 | |
| # -c adds diffs for merge commits | |
| logdiff = log -p -c | |
| # Ignore and stop ignoring changes to a file | |
| ignore = update-index --assume-unchanged | |
| unignore = update-index --no-assume-unchanged | |
| # Bring current branch up to speed with master | |
| #updatebr = !git pull && git merge master | |
| updatebr = "!f(){ git switch master && git pull && git switch $1 && git pull && git merge master; };f" | |
| # creates a branch, checks it out, and pushes it to the git server in one command | |
| crbr = "!f(){ git branch $1; git checkout $1; git push -u origin $1; };f" | |
| # resets back to head, losing all changes | |
| destroy = reset --hard HEAD | |
| # output current branch name | |
| currbr = "!f(){ git branch | grep \\* | cut -d ' ' -f2 | tr -d '\\n';};f" | |
| # copy current branch name to clipboard | |
| copybr = "!f(){ git currbr | clip;};f" | |
| # searches for string in branch names | |
| brsearch = "!f(){ git br -a | grep -i $1 | sed -e \"s/remotes\\/origin\\///g\" | sed -e \"s/* //g\" | sed -e \"s/ //g\" | sort | uniq;};f" | |
| # git grep that excludes js files | |
| grepjs = "!f() { git grep -i \"$1\" \":(exclude)*.js*\"; }; f" | |
| # searches all branches for the specified string | |
| search-all-branches = "!f() { for branch in $(git branch -r | grep -v '\\->'); do git grep \"$1\" $branch; done; }; f" | |
| conflict-diff = "!f() { \ | |
| t1=$(mktemp) && t2=$(mktemp) && \ | |
| git show :2:$1 >\"$t1\" && \ | |
| git show :3:$1 >\"$t2\" && \ | |
| git diff --no-index --color=always \"$t1\" \"$t2\" | delta --diff-so-fancy; \ | |
| ec=$?; rm -f \"$t1\" \"$t2\"; exit $ec; \ | |
| }; f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment