Skip to content

Instantly share code, notes, and snippets.

@Vadorequest
Last active June 21, 2023 06:19
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Vadorequest/9d1f86b19dff5e1f7946a2f6b15a97f3 to your computer and use it in GitHub Desktop.
Save Vadorequest/9d1f86b19dff5e1f7946a2f6b15a97f3 to your computer and use it in GitHub Desktop.
My own Git config
[push]
default = current
[alias]
fetch = git fetch --tags
reflog = git reflog --date=iso
st = status
ci = commit
co = checkout
br = branch
rz = reset --hard HEAD
unwip = reset HEAD^
pr = pull --rebase
cp = cherry-pick
oops = commit --amend --no-edit
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
wip = !git add --all && git ci -am "wip"
amend = !git add --all && git ci --amend
fake = !git commit --allow-empty -m "chore-fake-re-trigger-build"
branch-alias-master = "!f() {\
branch=$1;\
git symbolic-ref refs/heads/master refs/heads/${branch};\
}; f"
fix = "!f() {\
orig=$(git rev-parse --abbrev-ref HEAD);\
branch=$1;\
git checkout -b ${branch};\
git add --all;\
git commit;\
git push --set-upstream origin ${branch};\
git checkout ${orig};\
}; f"
ls = show --stat --oneline
rollback = reset --soft HEAD~1
rebase-and-delete = "!f() {\
if [ ! $1 ]; then exti 0; fi;\
orig=$(git rev-parse --abbrev-ref HEAD);\
branch=$1;\
git pull --rebase;\
git checkout ${branch};\
git pull --rebase origin ${orig} || exit 0;\
git push -f;\
git checkout ${orig};\
git rebase ${branch};\
git push;\
git branch -D ${branch};\
git push origin :${branch};\
}; f"
# Delete all local branches but master and the current one, only if they are fully merged with master.
br-delete-useless = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -d;\
}; f"
# Delete all local branches but master and the current one.
br-delete-useless-force = "!f(){\
git branch | grep -v "master" | grep -v ^* | xargs git branch -D;\
}; f"
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow
frag = magenta
old = red
new = green
[color "status"]
added = yellow
changed = green
untracked = cyan
[core]
editor = 'subl' --wait
trustctime = false
autocrlf = input
[fetch]
prune = true
[status]
showUntrackedFiles = all
[user]
name = Dhenain Ambroise
email = ambroise.dhenain@gmail.com
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[pull]
rebase = true
[init]
defaultBranch = main
[includeIf "gitdir:~/dev/dna-pc/"]
path = .gitconfig-dna-pc
[safe]
directory = /usr/local/Homebrew
# Handle GitHub identities
# See https://youtrack.jetbrains.com/issue/IDEA-192007/Github-with-multiple-accounts-support-ssh#focus=Comments-27-4825039.0-0
[url "git@personal-github:Vadorequest/"] # Personal
insteadOf = git@github.com:Vadorequest/
[url "git@dna-pc-github:DNA-PC/"] # DNA PC
insteadOf = git@github.com:DNA-PC/
[url "git@dna-pc-github:DNA-PC/"] # DNA PC (OLD way, using git@dna-pc.github.com in project's .git/config file)
insteadOf = git@dna-pc.github.com:DNA-PC/
[url "git@dna-pc-github:PWI-Works/"] # PWI
insteadOf = git@github.com:PWI-Works/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment