Skip to content

Instantly share code, notes, and snippets.

@davidrenne
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidrenne/6f04054aeadffea496ee to your computer and use it in GitHub Desktop.
Save davidrenne/6f04054aeadffea496ee to your computer and use it in GitHub Desktop.
Git Branch Management for multiple repositories in a project
#Repeat these scripts if you want to do branch management across similar repos in the same project obviously change your path /usr/local/repository & /usr/local/repository2 and copy more as needed
alias switch_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository && git fetch origin && git checkout $response && cd /usr/local/repository2 && git fetch origin && git checkout $response'
alias create_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository/ && git branch $response && git push origin $response && git checkout $response && cd /usr/local/repository2/ && git branch $response && git push origin $response && git checkout $response'
alias delete_branch='echo -n "Git branch name?>" && read response && cd /usr/local/repository/ && git checkout $response && git checkout master && git branch -d $response && git push origin :$response && cd /usr/local/repository2/ && git checkout $response && git checkout master && git branch -d $response && git push origin :$response'
alias tag='echo -n "Version Number (1.0.1)?>" && read response && cd /usr/local/repository/ && git tag -a "v""$response" -m $response && git push origin "v""$response" && cd /usr/local/repository2/ && git tag -a "v""$response" -m $response && git push origin "v""$response"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment