Skip to content

Instantly share code, notes, and snippets.

@joncode
Created February 18, 2026 05:41
Show Gist options
  • Select an option

  • Save joncode/64b8162e33e720dbe8d075b26e500bcc to your computer and use it in GitHub Desktop.

Select an option

Save joncode/64b8162e33e720dbe8d075b26e500bcc to your computer and use it in GitHub Desktop.
Quick bash script to make upstream branches for a dev/qa/prod codebase
git branch dev main && git push -u origin dev
git branch jg main && git push -u origin jg
git branch qa main && git push -u origin qa
git branch prod main && git push -u origin prod
@joncode
Copy link
Author

joncode commented Feb 27, 2026

fetch latest refs

git fetch origin

create local tracking branches

git switch -c dev --track origin/dev
git switch -c jg --track origin/jg
git switch -c qa --track origin/qa
git switch -c prod --track origin/prod

(main usually already tracks, but this makes it explicit)

git switch main
git branch --set-upstream-to=origin/main main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment