Skip to content

Instantly share code, notes, and snippets.

@rscircus
Created August 1, 2022 20:17
Show Gist options
  • Save rscircus/51459ff22a80fe16a3a795177d881a0f to your computer and use it in GitHub Desktop.
Save rscircus/51459ff22a80fe16a3a795177d881a0f to your computer and use it in GitHub Desktop.
rework git
# Git
#
function git() {
if [[ "$@" == "" ]]; then
command git status && command git remote -v && command git show-branch --list
elif [[ "$@" == "zip" ]]; then
command git archive --format=zip HEAD -o $(basename $PWD).zip --verbose
elif [[ "$@" == "uncommit" ]]; then
command git reset --soft HEAD~1
elif [[ "$@" == "pushall" ]]; then
command git push --all origin
elif [[ "$@" == "pull" ]]; then
BRANCH=`command git symbolic-ref --short HEAD`
echo Pulling from origin $BRANCH
command git pull origin $BRANCH
elif [[ "$1" == "config" ]]; then
command git "$@"
elif [[ "$@" == "diff" ]]; then
command git diff --ignore-space-at-eol -- . ':(exclude)package-lock.json' ':(exclude)yarn-lock.json'
else
command git "$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment