Last active
August 16, 2023 06:41
-
-
Save cas4ey/82f3a79baf538525baae15fd3e5cd15e 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
global .gitconfig | |
------------------------ | |
[user] | |
name = George Bush # User name displayed in commits | |
email = [email protected] # User email attached to every commit | |
[push] | |
default = current # git push current branch only (also sets upstream to the same branch at origin) | |
autoSetupRemote = true # automatically --set-upstream # atcually not working | |
[pull] | |
default = current | |
[merge] | |
tool = meld # custom tool for diff/merge | |
[difftool] | |
prompt = false # ??? | |
[alias] | |
branches = "!f() { git for-each-ref --format=' %(authorname) %09 %(refname)' --sort=authorname; };f" | |
camend = commit --amend -C HEAD # Don't forget to git add files before git camend !!! | |
compare = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative | |
dcommit = "!f() { export GIT_COMMITTER_DATE=\"$1\"; git commit --date=\"$1\" $2 $3 $4 $5 $6 $7 $8 $9; };f" | |
del = "!f() { git push --delete origin $1; git branch -D $1; };f" | |
dtag = "!f() { export GIT_COMMITTER_DATE=\"$1\"; git tag $2 $3 $4 $5 $6 $7 $8 $9; };f" | |
hist = log --graph --decorate # current branch commits up to HEAD (excluding remote) | |
history = hist --all # full git commits history for all branches | |
histu = hist @{u} # commits history for current branch incuding remote | |
k = "!f() { gitk --all --decorate; };f" | |
petch = "!f() { git fetch -p origin $1; };f" | |
pgc = "!f() { git prune; git gc; };f" | |
upstream = "!f() { git branch --set-upstream-to=origin/$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --abbrev-ref HEAD); };f" | |
# USAGE | |
# camend: git add <necessary files> (or git add -A); then git camend | |
# dcommit: git dcommit "2018-12-31T23:59:59" -m "Commit message" | |
# dtag: git dtag "2018-12-31T23:59:59" -a -m "Tag message" v1.0.0 # use '-s' instead of '-a' if you want to sign tag with GPG-key | |
# dtag: git dtag "2018-12-31T23:59:59" -a -f <path-to-file-with-tag-message> v1.0.0 # use instead of '-m' for huge messages | |
# git petch ==> to fetch all branches | |
# git petch develop ==> to fetch only develop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment