-
-
Save AFulgens/21ceace3cd0cd90844978a456b8f79d2 to your computer and use it in GitHub Desktop.
Gitconfig file
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
##################### | |
# MANDATORY: BASICS # | |
##################### | |
[user] | |
# your e-mail address for two keys to have general tooling support | |
email = [email protected] | |
mail = [email protected] | |
# your name should be <surname> <firstname> in case this makes it consistent (e.g., corporate LDAP environment) | |
# otherwise the only necessity is to have it consistent across your projects | |
name = Surname Firstname | |
# either fully qualified path to your SSH public key used for signing, or the full fingerprint of your GPG/PGP key | |
signingkey = C:/Users/me/.ssh/id_ed25519_sk.pub | |
[gpg] | |
format = ssh | |
# in case using GPG/PGP instead of SSH for signing, comment the above line and uncomment the below line | |
# program = gpg | |
[gpg "ssh"] | |
# file listing allowed signers' SSH keys, should include yourself | |
allowedSignersFile = C:/Users/me/.ssh/allowed_signers | |
[commit] | |
# sign all your commits by default, this is used for SSH-based signing too | |
gpgsign = true | |
[tag] | |
# sign all your tags by default, this is used for SSH-based signing too | |
gpgsign = true | |
[core] | |
# to avoid misery | |
autocrlf = true | |
fscache = true | |
ignoreCase = true | |
longpaths = true | |
symlinks = false | |
# 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 = manager | |
#[credential "https://dev.azure.com"] | |
# # in case you are working in a M365 environment | |
# usehttppath = true | |
#[http] | |
# # if you are using non-global CAs | |
# sslCAInfo = /path/to/crt-file.crt | |
#################### | |
# OPTIONAL: BASICS # | |
#################### | |
[color] | |
# beautification | |
ui = auto | |
interactive = true | |
[color.diff] | |
whitespace = red reverse | |
[help] | |
format = html | |
[init] | |
# e.g., if using pre-commit (cf. https://pre-commit.com/) | |
templateDir = C:/Users/me/git-init-template | |
[mailmap] | |
# to have a generic mailmap file, note that tool support is currently "meh" | |
file = C:/Users/me/.mailmap | |
[merge] | |
# see https://git-scm.com/docs/git-config | |
conflictstyle = diff3 | |
tool = p4merge | |
[difftool] | |
prompt = false | |
[mergetool] | |
prompt = false | |
keepBackup = false | |
[rebase] | |
autosquash = false | |
[rerere] | |
enabled = 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