From 6882610a0e0ed1885fb8e8ebea56786042f18c68 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Thu, 5 Dec 2024 18:07:16 +0100 Subject: [PATCH] show git aliases --- setup/git-aliases.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 setup/git-aliases.md diff --git a/setup/git-aliases.md b/setup/git-aliases.md new file mode 100644 index 0000000..ecbcfd8 --- /dev/null +++ b/setup/git-aliases.md @@ -0,0 +1,41 @@ +--- +volume: Decentrala +section: 6 +title: git aliases +author: Malin +source: dmz.rs +--- + +## Aliases + +Put these in `~/.bash_aliases` + +``` +alias gb='git branch' +alias gc='git add -p . && git commit' +alias gd="git diff --word-diff" +alias gl='git log --graph --show-signature' +alias gla="git log --all --decorate --oneline --graph" +alias gm='git merge' +alias gis='git status' +``` + +## Dangerous Aliases + +Get a fuzzy-finder, like `fzy,` or `sk` (called `sk-im` in the repos), and checkout faster: + +``` +alias gco='git checkout --recurse-submodules $(sk -c "git branch | cut -c 3-")' +``` + +Delete all changes and start again instantly: + +``` +alias grs='git reset --hard HEAD' +``` + +Push to remotes that don't use http: + +``` +alias gpa='git remote show | while read remote; do git remote get-url $remote | grep -qv http && git push $remote; done' +```