Skip to content

Instantly share code, notes, and snippets.

@jeremysimmons
Last active June 21, 2023 15:24
Show Gist options
  • Save jeremysimmons/91ee057df69e39b1752d98d20ef8b83c to your computer and use it in GitHub Desktop.
Save jeremysimmons/91ee057df69e39b1752d98d20ef8b83c to your computer and use it in GitHub Desktop.
gitconfig
[user]
email = jsimmons@jeremysimmons.net
name = jeremy simmons
[alias]
# Get the current branch name (not so useful in itself, but used in other aliases)
branch-name = "!git rev-parse --abbrev-ref HEAD"
# Push the current branch to the remote "origin", and set it to track the upstream branch
publish = "!git push -u origin $(git branch-name)"
# Delete the remote version of the current branch
unpublish = "!git push origin :$(git branch-name)"
c = commit
cm = commit -m
cam = commit -am
a = add
co = checkout
cob = checkout -b
aa = !git add -u && git add . && git status
br = rev-parse --abbrev-ref HEAD
# reset current branch to the upstream tracking branch. ie. origin/current-branch
# useful for when you've rebased in github, and want to reset local to match
rbcb = !git fetch origin && git reset --hard @{upstream}
# rebase onto main
rbmain = !git fetch origin && git rebase origin/main
psf = push --force-with-lease
plf = pull --force
# add changes, ammend w/out comment and push
amp = !git add . && git commit --amend --no-edit && git push --force
ff = !dotnet format && git add . && git commit -m "dotnet format" && git push
[merge]
tool = bc
[mergetool "bc"]
path = c:/Program Files/Beyond Compare 4/bcomp.exe
[difftool]
prompt = false
[mergetool]
keepBackup = false
[core]
autocrlf = true
longpaths = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment