Skip to content

Instantly share code, notes, and snippets.

@weiserr
Last active May 3, 2022 13:06
Show Gist options
  • Save weiserr/85af1d652d44d6ac26dd to your computer and use it in GitHub Desktop.
Save weiserr/85af1d652d44d6ac26dd to your computer and use it in GitHub Desktop.
Gitconfig file
[user]
name = Robert Weiser
email = mc.weiser@gmail.com
[color]
ui = true
[core]
autocrlf = true
pager = less -r
[alias]
st = status
last = log -1 HEAD # displays the last commit message
oneline = log --pretty=oneline # displays the log using one line per log message
ci = commit
b = branch -a -vv # shows all local and remove branches
co = checkout
backup = !git push -f origin $(git rev-parse --abbrev-ref HEAD):$(git rev-parse --abbrev-ref HEAD | sed "s=feature=user/$USER=g") # creates a backup of the currently checked out feature branch on the remote in the /usr/${USER}/${feature} branch
cleanup = !git merged | xargs -i git branch -D {} | cat && git merged | sed s=feature=refs/heads/user/$USER=g | xargs -i git push origin --delete {} | cat
merged = !git branch -r | grep origin/user/$USER | sed s=origin/user/$USER=feature=g | xargs -i echo '[[ ! -z $(git log --first-parent --grep={}) ]] && echo {}' | bash
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short # displays the history on the console
conflicts = log -c -1 --name-status # displays files that were both edited in the current and another branch (potential conflicts)
all-conflicts = !git log --merges -c --name-status | grep -B 12 ^[AM]M # displays real conflicts in the whole repository that required manual conflict resolution
assume = update-index --assume-unchanged # assume that a single file has not been changed
unassume = update-index --no-assume-unchanged # revert change-assumptions for a single file
assumed = !git ls-files -v | grep ^h | cut -c 3- # shows all files that are assumed not being changed
assumeall = !git st -s | awk {'print $2'} | xargs git assume # assumes that all modified files have not been changed
unassumeall = !git assumed | xargs git update-index --no-assume-unchanged # resets all assumptions
ribbon = tag --force _ribbon origin/master
catchup = log --patch --reverse --topo-order _ribbon..origin/master
pr = "!f() { if [ ! -z $(git config bitbucket.url) ] ; then start "$(git config bitbucket.url)/pull-requests?create\\&targetBranch=refs/heads/${1:-develop}\\&sourceBranch=refs/heads/$(git rev-parse --abbrev-ref HEAD)" ; else echo "Please configure the Bitbucket URL by running: git config bitbucket.url \\<bitbucket.repo.url\\>" ; return 1 ; fi }; f" # creates a PR
[push]
default = current
[merge]
tool = p4merge
[mergetool]
prompt = false
keepBackup = false
[mergetool "p4merge"]
cmd = D:/Tools/Perforce/p4merge.exe $BASE $LOCAL $REMOTE $MERGED
trustExitCode = false
[diff]
tool = p4merge
[difftool]
prompt = false
[difftool "p4merge"]
cmd = D:/Tools/Perforce/p4merge.exe $LOCAL $REMOTE
[rerere]
enabled = 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment