Skip to content

Instantly share code, notes, and snippets.

@oliverspryn
Created February 18, 2022 15:59
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 oliverspryn/e267f9881b7ab0279cf6b4208c21fd5e to your computer and use it in GitHub Desktop.
Save oliverspryn/e267f9881b7ab0279cf6b4208c21fd5e to your computer and use it in GitHub Desktop.
Set a Git branch's upstream with a single command
git checkout origin branch_that_is_already_on_origin
git upstream
# To use, add this to your ~/.gitconfig file
[alias]
upstream = !git branch --set-upstream-to=origin/`git symbolic-ref --short HEAD`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment