Created
August 24, 2017 22:55
-
-
Save vickoman/95617f100a690fbd5c29fe7b0a5ced35 to your computer and use it in GitHub Desktop.
Git-Helpers
This file contains 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
# Funcion que hace: Add | commit al branch que estemos en ese momento sin hacer push | |
# @Params: Recibe como parametro el mensaje del commit | |
function __commit { | |
if [ -z $1 ]; then | |
echo "Debe poner el texto del commit" | |
else | |
git add -A . | |
git commit -m "$1" | |
fi | |
} | |
# Funcion que hace: Add | commit | push al branch que estemos en ese momento | |
# @Params: Recibe como parametro el mensaje del commit | |
function __commitPush { | |
if [ -z $1 ]; then | |
echo "Debe poner el texto del commit" | |
exit 1; | |
else | |
git add -A . | |
git commit -m "$1" | |
fi | |
echo "-----------------------------------------" | |
echo "PUSHEANDO A $(git symbolic-ref --short -q HEAD)" | |
sleep 1 | |
git push origin $(git symbolic-ref --short -q HEAD) | |
} | |
# Funcion que hace: push al branch que estemos en ese momento | |
# @Params: No Recibe | |
function __pushCurrentBranch { | |
echo "-----------------------------------------" | |
echo "PUSHEANDO A $(git symbolic-ref --short -q HEAD)" | |
git push origin $(git symbolic-ref --short -q HEAD) | |
} | |
# Funcion que hace: push al branch que estemos en ese momento | |
# @Params: No Recibe | |
function __pullCurrentBranch { | |
echo "-----------------------------------------" | |
echo "Pulleando A $(git symbolic-ref --short -q HEAD)" | |
git pull origin $(git symbolic-ref --short -q HEAD) | |
} | |
# Aliases | |
alias commit="__commit" # i.e type in the console: commit "Este solo es un commit" | |
alias commitPush="__commitPush" # i.e type in the console: commitPush "Este solo es un commit de todo y lo mando al branch en que estamos" | |
alias pushcb="__pushCurrentBranch" # i.e type in the console: pushcb | |
alias pullcb="__pullCurrentBranch" # i.e type in the console: pullcb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment