Last active
November 16, 2024 15:06
-
-
Save n1kk/869c293646868aaa22fedad46e2e13d9 to your computer and use it in GitHub Desktop.
my git 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
[alias] | |
aliases = config --get-regexp alias | |
# fetch latest default branch and switch to it in one go | |
master = !git fetch origin master:master && git switch master | |
main = !git fetch origin main:main && git switch main | |
# push new local branch that does not exist on remote | |
publish = push -u origin HEAD | |
# remove all local branched that were deleted on remote | |
prune-branch = !git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d | |
# start ssh agent to save git password for current session | |
# useage: eval `git agent` | |
agent = "!echo 'eval `ssh-agent`; ssh-add ~/.ssh/__YOUR_KEY__'" | |
# override for local repos that use other key | |
# agent = "!echo 'eval `ssh-agent`; ssh-add ~/.ssh/__SOME_OTHER__KEY'" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment