Home > Enterprise >  Why does a new local branch immediately start tracking the local branch it was created from and how
Why does a new local branch immediately start tracking the local branch it was created from and how

Time:01-07

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.

CodePudding user response:

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).

  • Related