Last active
July 12, 2024 08:19
-
-
Save rdaniel0/80cb347dd063a70f48d337cfab0cfe7f to your computer and use it in GitHub Desktop.
.gitconfig aliases
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
# A list of handy alises I use daily | |
# template (e.g echo the first parameter) | |
test = "!f(){ echo ${1}; };f" | |
[alias] | |
# Open alises file | |
alises = "!f() { code ~/.gitconfig; };f" | |
# Show all branches | |
br = branch -l | |
# Add everytning and stash | |
sa = add . && git stash | |
# Stash staged files | |
ss = !git stash --keep-index && \ | |
git stash && \ | |
git stash apply stash@{1} && \ | |
git stash show -p | git apply -R && \ | |
git stash drop stash@{1} | |
# reset N commits | |
rs = "!f(){ git reset head~${1}; };f" | |
rsh = "!f(){ git reset --hard head~${1}; };f" | |
# squash N commits | |
sq = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f" | |
# commit and amend without editing | |
amd = commit --amend --no-edit | |
# rebase from origin/main | |
re = !git fetch && git rebase origin/main | |
# rebase onto branch | |
ro = "!f(){ git rebase --onto ${1} HEAD~${2}; };f" | |
# rebase onto main | |
rom = "!f(){ git fetch && git rebase --onto origin/main HEAD~${1}; };f" | |
# force push | |
fp = push -f | |
# amend, force push | |
af = !git amd && git fp | |
# amend, rebase, force push | |
arf = !git amd && git re && git fp | |
# create branch from main | |
cb = "!f(){ git fetch && git checkout -b ${1} main; };f" | |
# rebase interactive | |
rei = "!f(){ git rebase -i HEAD~${1}^; };f" | |
rec = rebase --continue | |
# store current work in wip commit | |
wip = "!f(){ git add . && git commit -m \"wip: wip\"; };f" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment