0

It used to be that every time I created a new feature branch with Magit, I would do this in the Magit buffer:

  • Fetch from all remotes (f a)
  • Change to my local master branch (b b master RET)
  • Rebase that branch on the remote master branch (r u)
  • Create a new feature branch based on my local master branch (b c master RET feature RET).

I didn't use my local master branch for anything other than spinning off new branches. Eventually I thought, hey, I can make this process shorter by just creating a new branch based on the remote branch:

  • Fetch from all remotes (f a)
  • Create a new branch based on the remote master branch (b c origin/master RET feature RET)

That would be great, except that the new branch now has origin/master set as its remote tracking branch. I'd rather have it be created with no remote tracking branch, so that when I eventually push, I'll be prompted for the obvious remote branch name origin/feature and just accept that. So I need one more step:

  • Unset the remote tracking branch (b u)

I'd rather not have to do this every time. Is there some way to create a new branch based on a remote branch without also making the remote branch a tracking branch? I've pored through the Magit docs and searched online without success. The only thing I found to try is this:

(setq magit-branch-adjust-remote-upstream-alist '((nil . "master")))

...but the docs for that variable don't suggest that nil is an acceptable upstream, and indeed, this doesn't work.

1 Answer 1

0

I couldn't find a way to do this on a per-branch-creation basis with Magit, but further digging turned up a Git configuration option branch.autoSetupMerge that controls the setting up of tracking when the starting branch is remote. So all I had to do is run this command:

git config --global branch.autoSetupMerge false

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.