Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Why does a new local branch immediately start tracking the local branch it was created from and how do I turn this off?

I have a very strange problem. Whenever I create a new branch, that new branch starts tracking the branch it was created from. For example, if I’m on the main branch and create a new branch, new immediately starts tracking the master branch. I literally get the message branch 'new' set up to track 'master'. If I create another branch anotherBranch it will immediately be set to track either main or new depending which branch it was created from. Switching, for example to new, I’m getting a message like Your branch is behind 'main' by 1 commit, and can be fast forwarded. or something like that (I mean, it behaves the same as I have a track between the local branch and correspondent remote branch). Does anyone know why this is happening and how to fix it?

It started happening all of a sudden, not before… I even tried reinstalling Git, but unfortunately it didn’t work.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You have branch.autoSetupMerge git config variable set to always. To quote the manual:

always — automatic setup is done when the starting point is either a local branch or remote-tracking branch

[…]

This option defaults to true.

So you can unset it and git will use the default:

git config --unset branch.autoSetupMerge

(maybe you’ll need to add the --global or other file-selecting option).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading