Sublime Forum

Pushing to origin by default, regardless of upstream branch

#1

In the organization that I work for, everyone has their own fork for each project, and every contribution must go through the pull request workflow. I frequently track branches from other remotes, but I never want to push to them. Is there a way to make the Sublime Merge client push to origin by default, rather than the designated upstream branch?

This is how I’ve traditionally done this via command line, where upstream belongs to the organization, and origin is my fork…

git fetch upstream
git checkout -b my_branch upstream/some_other_branch
git push origin my_branch
0 Likes

#2

You should be able to accomplish that by doing the fetch, and then right clicking on the commit in the commit tree and choosing the Create branch at commit option. That would create you a branch that’s at the same commit just as the command you’re used to using would, which would push up as the branch you create it as because it’s not associated with the upstream.

This is in contrast to right clicking on the remote branch and choosing the checkout option, which would check out the branch and set the upstream automatically (IIRC).

1 Like

#3

So with that option, rather than automatically pushing to origin, it forces me to choose a remote each time I go to push, which is kind of a step in the right direction. But I actually want the upstream to point to the organization’s repository so that I get the ahead/behind count. I just need it to push to origin rather than upstream by default.

Should I propose it as a feature request?

0 Likes

#4

I’m not familiar with such a workflow personally, but there is a Set Upstream command that’s in the command palette and context menus of branches (under the name of the branch) that sets up the remote tracking branch, and when you push if there are multiple remotes you can choose the one you want.

So it sounds like in theory something like this would be possible. I would suspect that the push dialog would favour the remote that’s set as the upstream though, so it seems like it would be a manual choice. However it looks like you have to manually specify origin as well and not upstream in your push, so perhaps that’s the same?

0 Likes