Created
September 23, 2021 17:41
-
-
Save Vaansh/e07377a51d1616aae1fd406b9de7dd17 to your computer and use it in GitHub Desktop.
function to ease pushing changes made in remote repos for work/school
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
function gcp() { | |
echo "> New branch? [+used for remote branch] ('n' or 'no' for no, anything else for yes)" | |
read newbranch | |
if [ "${newbranch^^}" != "N" ] && [ "${newbranch^^}" != "NO" ] | |
then | |
echo "> Name of new branch: [+used for remote branch]" | |
read newbranchname | |
git checkout -b $newbranchname | |
fi | |
git status | |
echo "> Files to add:" | |
read filestoadd | |
git add $filestoadd | |
echo "> Enter commit message to add:" | |
read msg | |
git commit -m "${msg}" --no-verify | |
git push origin $(git branch | sed -n -e 's/^\* \(.*\)/\1/p') | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment