Skip to content

Instantly share code, notes, and snippets.

@dilkhush
Last active September 15, 2016 09:11
Show Gist options
  • Save dilkhush/27af19c7c7faee7f609a to your computer and use it in GitHub Desktop.
Save dilkhush/27af19c7c7faee7f609a to your computer and use it in GitHub Desktop.
Working with multiple branches taking pull and push with current branch
While working with multiple branches we need to type the branch name all the time while pull and push the data
below are two small script that can help you with that
---- push.sh
BRANCH=$(git branch | grep ^* | sed 's/* //' )
echo $BRANCH
git push origin $BRANCH
----pull.sh
BRANCH=$(git branch | grep ^* | sed 's/* //' )
echo $BRANCH
git pull origin $BRANCH
when you want to take pull just run
$ sh pull.sh
when you want to take push just run
$ sh push.sh
It will find the current branch for you and will perform the action
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment