Last active
September 24, 2021 20:54
-
-
Save sarpavci/4410d65a629e3f11483fb29c4f7f5be9 to your computer and use it in GitHub Desktop.
Bash aliases only git commands
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
| function git-commit() { | |
| ref=$(git symbolic-ref HEAD --short) | |
| git commit -m"$ref $@" | |
| } | |
| function git-reset-hard() { | |
| git reset --hard origin/"$@" | |
| } | |
| function git-open-pr() { | |
| ref=$(git symbolic-ref HEAD --short) | |
| repo=$(git remote get-url origin | sed -En "s/git@(.*):(.*)\/(.*).git/https:\/\/\1\/\2\/\3/p") | |
| open "$repo/compare/$ref?expand=1" | |
| } | |
| function git-amend() { | |
| ref=$(git symbolic-ref HEAD --short) | |
| git commit --amend -m"$ref $@" | |
| } | |
| function git-push() { | |
| ref=$(git symbolic-ref HEAD --short) | |
| git push origin $ref | |
| } | |
| function git-force-push() { | |
| ref=$(git symbolic-ref HEAD --short) | |
| git push origin $ref -f | |
| } | |
| function git-pull() { | |
| ref=$(git symbolic-ref HEAD --short) | |
| git pull origin $ref | |
| } | |
| alias art='php artisan' | |
| alias g:s='git status' | |
| alias g:ss='git stash save -u $*' | |
| alias g:sp='git stash pop' | |
| alias g:sl='git stash list' | |
| alias g:sd='function() { git stash drop stash@{$@}; }' | |
| alias g:r='git reset $*' | |
| alias g:ro='git-reset-hard $*' | |
| alias g:rb='git rebase $*' | |
| alias g:d='git diff $*' | |
| alias g:D='git diff $*' | |
| alias g:l='git log --oneline --graph --decorate --max-count=10 $*' | |
| alias g:m='git merge $*' | |
| alias g:b='git branch -v' | |
| alias g:bd='git branch -D $*' | |
| alias g:p='git-pull $*' | |
| alias g:P='git-pull $*' | |
| alias g:ps='git-push $*' | |
| alias g:psf='git-force-push $*' | |
| alias g:psu='git-push --set-upstream $*' | |
| alias g:cl='git clone $*' | |
| alias g:c='git-commit $*' | |
| alias g:C='git-commit $*' | |
| alias g:ca='git-amend $*' | |
| alias g:Ca='git-amend $*' | |
| alias g:add='git add $*' | |
| alias g:Add='git add $*' | |
| alias g:all='git add .' | |
| alias g:f='git fetch' | |
| alias g:fp='git fetch && git-pull' | |
| alias g:cf-files='git diff --name-only --diff-filter=U' | |
| alias g:co='git checkout $*' | |
| alias g:t='git tag -a v$*' | |
| alias g:pr='git-open-pr' | |
| alias uports='lsof -iTCP -sTCP:LISTEN -n -P' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment