Last active
March 11, 2021 04:13
-
-
Save crmorgan/9a03d1eb857cad27a9db4dbb4b7f4aed to your computer and use it in GitHub Desktop.
Git Config
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 = | |
email = | |
[core] | |
autocrlf = true | |
editor = 'C:/Program Files/Notepad++/notepad++.exe' -multiInst -nosession | |
[diff] | |
tool = bc | |
[difftool] | |
prompt = false | |
[merge] | |
tool = bc | |
[mergetool] | |
prompt = true | |
keepBackup = false | |
[difftool "bc"] | |
path = c:/Program Files/Beyond Compare 4/bcomp.exe | |
[mergetool "bc"] | |
path = c:/Program Files/Beyond Compare 4/bcomp.exe | |
[difftool "sourcetree"] | |
cmd = 'C:/Program Files/Beyond Compare 4/BCompare.exe' \"$LOCAL\" \"$REMOTE\" | |
[mergetool "sourcetree"] | |
cmd = 'C:/Program Files/Beyond Compare 4/BCompare.exe' \"$LOCAL\" \"$REMOTE\" \"$BASE\" -o \"$MERGED\" | |
trustExitCode = true | |
[color] | |
branch = auto | |
diff = auto | |
status = 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 | |
[push] | |
default = current | |
[pull] | |
rebase = false | |
[fetch] | |
prune = false | |
[rebase] | |
autoStash = false | |
[alias] | |
#https://github.com/haacked/dotfiles/blob/main/git/gitconfig.aliases.symlink | |
aliases = "!git config -l | grep ^alias\\. | cut -c 7-" | |
aa = add --all | |
amend = commit -a --amend | |
# Deletes all branches merged into the specified branch (or the default branch if no branch is specified) | |
# Only run on topic branches | |
bclean = "!f() { DEFAULT=$(git default); git branch --merged ${1-$DEFAULT} | grep -v " ${1-$DEFAULT}$" | xargs git branch -d; }; f" | |
# Switches to specified branch (or the dafult branch if no branch is specified), runs git up, then runs bclean. | |
# Only run on topic branches | |
bdone = "!f() { DEFAULT=$(git default); git checkout ${1-$DEFAULT} && git up && git bclean ${1-$DEFAULT}; }; f" | |
br = branch | |
# Lists the files with the most churn | |
churn = !git --no-pager log --name-only --oneline | grep -v ' ' | sort | uniq -c | sort -nr | head | |
co = checkout | |
cob = checkout -b | |
ci = commit | |
cia = commit --amend | |
default = !git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@' | |
last = log -1 HEAD | |
lfp = log --first-parent | |
pf = push origin HEAD --force | |
rr = !sh -c \"git push origin +HEAD:remote-run/$1\" - | |
rrd = !sh -c \"git push origin --delete remote-run/$1\" - | |
lg = !git lg2 | |
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)' | |
restore = "!f(){ git add -A && git commit -qm 'RESTORE SAVEPOINT'; git reset $1 --hard; }; f" | |
rhh = reset --hard HEAD | |
rp = "!sh -c \"git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -d $branch; done\" -" | |
rpo = remote prune origin | |
# Adds all changes including untracked files and creates a commit | |
save = !git add -A && git commit -m 'SAVEPOINT' | |
st = status -sbu | |
# Run after save or wip to reset the previous commit keeping all the changes in the working directory | |
undo = reset HEAD~1 --mixed | |
unstage = reset HEAD -- | |
untrack = update-index --assume-unchanged | |
up = !git pull --rebase --prune $@ && git submodule update --init --recursive | |
# Brings the branch up to speed with the origin | |
up = !git pull --rebase --prune $@ && git submodule update --init --recursive | |
# Add all tracked changes and creates a commit | |
wip = !git add -A && git commit -m 'WIP' | |
# Commits everything in working directory and then does a hard reset to remove the commit. The commit is still there via git reflog. | |
wipe = "!f() { rev=$(git rev-parse ${1-HEAD}); git add -A && git commit --allow-empty -qm 'WIPE SAVEPOINT' && git reset $rev --hard; }; f" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment