Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Got error: the requested upstream branch 'origin/test' does not exist Commented Sep 26, 2022 at 11:44
  • @VitalyZdanevich that means you haven't pushed your branch yet. (This question was about setting your upstream after you already pushed the branch.) In your case you can set the upstream on the first push, something like git push --set-upstream origin test Commented Sep 26, 2022 at 14:22
  • But can I set upstream without push/pull? I want to have an alias that will create a new branch and set the upstream, currently I have this broken code: [alias] cr = "!f() { git switch -c $1; git branch --set-upstream-to=origin/master $1; }; f" Commented Sep 26, 2022 at 14:54
  • @VitalyZdanevich I don't know of a good way to say "this is what I will want to track once I push it." I suppose you could update your alias to push it out at branch creation with the upstream set, though it might be odd to announce a new branch name with no new commits on it yet, but at least it would accomplish your goal... Commented Sep 26, 2022 at 15:27