Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

branch

egit

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.

like image 830
SantiBailors Avatar asked Nov 18 '16 13:11

SantiBailors


2 Answers

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.

like image 128
torek Avatar answered Oct 16 '22 05:10

torek


I suppose it is telling you that storing your code at another location on the same device is not helping you to preserve the code. Whereas pushing to GitHub or BitBucket would allow you to destroy your device and still have the code. i.e. Storing your code locally twice is not more save.

To fix this make a repo on either BitBucket (allows private repo's for free) or GitHub and push your code there.

like image 25
Maarten Bicknese Avatar answered Oct 16 '22 04:10

Maarten Bicknese