Checkout as new branch that also creates the branch remotely and sets tracking accordingly (git)

Here's my current workflow:

I have a remote branch "origin/master".
I checkout a new local branch from that remote branch and call it "v1.7-fixes"

Now, when I push changes I select "push current branch to alternative branch" so that I create and push to a new "v1.7-fixes" branch on origin (instead of origin/master).

Next, in order to avoid having to select the new v1.7-fixes branch as an alternative every time I push I need to go into the .git/config file and change the 'merge' setting for the v1.7-fixes branch to use the new remote branch instead of master.

Is there a way to do this in PyCharm without having to hand edit the git config file (or a better way to do this in general)?
Currently there is no way to change the tracking setting.

However, I would advice another workflow to avoid need of this. Instead of checking out from origin/master, checkout from master. It won't set up tracking (because you're checking out from a local branch), and once you push your new branch to the remote, the tracking will be set up correctly.

Your offered solution is unhelpful. There's no reason why I would keep a local outdated master branch. I always create my branches from remote ones and so do most developers in companies I've worked in.


Please sign in to leave a comment.