Search code examples
gitbranchegit

EGit: why "Local branch as upstream is not recommended"?


When I create a new branch, if I set "Configure upstream for push and pull" a warning appears (circled in blue in the screenshot). Why is that not recommended ? What potential problems or disadvantages does that have ?

I ran that warning through search engines and searched for it on https://git-scm.com and https://www.eclipse.org/egit/ but I found nothing, and when I click the "?" help button in that dialog nothing happens.

"Create Branch" dialog.

Also, if I wanted to follow the suggestion from that warning and "use remote branch", how do I do that ? Except of course the "Configure upstream for push and pull" checkbox, nothing that I change in that dialog causes the warning to disappear.


Solution

  • There is nothing wrong with setting another local branch as your upstream. It just means that git fetch does nothing—you already have all your own commits; git merge merges from the other branch; git rebase rebases onto the other branch; and git push attempts to fast-forward the other branch, or fails if it cannot.

    The "other branch" (the upstream) is your own ordinary local branch, stored in your repository as usual. You are therefore your own upstream (and your own downstream, when viewed from the other branch). It feels a bit incestuous. :-)

    It's completely not clear to me what other local branch EGit is going to set as the upstream, here. (I don't use EGit.) My guess, based on the stuff in the image, is master.