-
-
Save AFulgens/21ceace3cd0cd90844978a456b8f79d2 to your computer and use it in GitHub Desktop.
Gitconfig file
This file contains 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
##################### | |
# MANDATORY: BASICS # | |
##################### | |
[user] | |
# your e-mail address for two keys to have general tooling support | |
email = [email protected] | |
mail = [email protected] | |
# your name in <firstname> <surname> format, accentise as you see fit (but be consistent across projects!) | |
name = Robert Weiser | |
[core] | |
# to avoid misery | |
autocrlf = true | |
ignoreCase = true | |
longpaths = true | |
# optional, mostly for debugging control-character issues | |
pager = less -r | |
# optional, if you prefer an edit over the default 'vi' | |
editor = vim | |
###################### | |
# OPTIONAL: SECURITY # | |
###################### | |
#[credential] | |
# # in case you are working from Windows | |
# helper = wincred | |
#[http] | |
# # if you are using non-global CAs | |
# sslCAInfo = /path/to/crt-file.crt | |
#################### | |
# OPTIONAL: BASICS # | |
#################### | |
[color] | |
# beautification | |
ui = true | |
[merge] | |
# see https://git-scm.com/docs/git-config | |
conflictstyle = diff3 | |
tool = p4merge | |
[difftool] | |
prompt = false | |
[mergetool] | |
prompt = false | |
keepBackup = false | |
######################## | |
# OPTIONAL: SourceTree # | |
######################## | |
# HINT: update the P4Merge paths! | |
#[difftool "sourcetree"] | |
# cmd = 'C:/Projects/tools/P4Merge/p4merge.exe' \"$LOCAL\" \"$REMOTE\" | |
#[mergetool "sourcetree"] | |
# cmd = 'C:/Projects/tools/P4Merge/p4merge.exe' \"$BASE\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\" | |
# trustExitCode = true | |
###################### | |
# OPTIONAL: ALIASING # | |
###################### | |
[alias] | |
### BASICS | |
# shorthand for committing | |
ci = commit | |
# shorthand for checking out | |
co = checkout | |
### DISPLAYS | |
# current status of the staging | |
st = status | |
# all existing branches | |
b = branch -a -vv | |
# last commit | |
last = log -1 | |
# history with one line per commit | |
oneline = log --pretty=oneline | |
# history as a graph | |
hist = log --pretty=format:'%h %ad | %s%d [%an]' --graph --date=short | |
# shows all files that are assumed not being changed | |
assumed = !git ls-files -v | grep ^h | cut -c 3- | |
### LOCAL UPDATES | |
# assume that a single file has not been changed | |
assume = update-index --assume-unchanged | |
# assumes that all modified files have not been changed | |
assumeall = !git st -s | awk {'print $2'} | xargs git assume | |
# revert change-assumptions for a single file | |
unassume = update-index --no-assume-unchanged | |
# resets all assumptions | |
unassumeall = !git assumed | xargs git update-index --no-assume-unchanged | |
### REMOTE UPDATES (USE WITH CAUTION!) | |
# creates a backup of the currently checked out feature branch on the remote in the backup/${USER}/${feature} branch | |
backup = !git push -f origin $(git rev-parse --abbrev-ref HEAD):$(git rev-parse --abbrev-ref HEAD | sed "s=feature=backup/$USER/feature=g") | |
# deletes local branches and backup branches of features that have been merged | |
cleanup = !git branch --merged | grep -v '*' | grep feature | sed s=feature=refs/heads/backup/$USER/feature=g | xargs -i git push origin --delete {} && git branch --merged | grep -v '*' | grep 'feature/' | xargs -i git branch -d {} | |
cleanupremote = !git branch -r --merged | grep feature | xargs -L1 | cut -d"/" -f2- | xargs -i git push origin --delete {} # delete all remote feature branches that have been re-integrated to the current HEAD | |
### ADDITIONAL ALIASES AS YOU SEE FIT | |
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 | |
ribbon = tag --force _ribbon origin/master | |
catchup = log --patch --reverse --topo-order _ribbon..origin/master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment