- run
echo $(basename $SHELL)
and note the output of it on mac its generallyzsh
and on linux it will bebash
- if the above output
- is zsh then copy all the contents of the file another file in this gist to
$HOME/.zshrc
- is bash then copy all the contents of the file another file in this gist to
$HOME/.bashrc
- is zsh then copy all the contents of the file another file in this gist to
- Restart your terminal
Last active
June 27, 2021 17:01
-
-
Save technikhil314/8d1f6ae4872192057b08edc2ac5c8f71 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 gitHouseKeeping="git gc && git gc --prune && git remote prune origin && git prune && git clean -df" | |
git-amend-old() ( | |
# Stash, apply to past commit, and rebase the current branch on to of the result. | |
current_branch="$(git rev-parse --abbrev-ref HEAD)" | |
apply_to="$1" | |
git stash | |
git checkout "$apply_to" | |
git stash apply | |
git add -u | |
git commit --amend --no-edit | |
new_sha="$(git log --format="%H" -n 1)" | |
git checkout "$current_branch" | |
git rebase --onto "$new_sha" "$apply_to" | |
) | |
commitwithstash() { | |
ga . && gsta && gc -m $1 && gstp | |
} | |
alias uncommit="git reset HEAD~1" | |
alias recommit="git commit --amend --no-edit" | |
alias editcommit="git commit --amend" | |
alias bfg="java -jar ~/installs/bfg.jar" | |
alias grss="git restore --staged" | |
revert() { | |
git revert $(git rev-parse HEAD) | |
} | |
resethard() { | |
git reset --hard $(git rev-parse --abbrev-ref --symbolic-full-name @{u}) | |
} | |
squashlast () { | |
git rebase -i HEAD~$1 | |
} | |
unalias gcl | |
gcl() { | |
dirName=$(basename $1 .git) | |
git clone $1 | |
cd $dirName | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment