Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » repo cloned from "origin", now not certain how to properly switch to fork/master
repo cloned from "origin", now not certain how to properly switch to fork/master [message #1715759] Wed, 25 November 2015 18:39 Go to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
I originally cloned a github repo to my desktop and in Eclipse, I imported projects from that cloned repo.

In Github, I then forked the github repo and created a branch.

In Eclipse, I created a remote pointing to the fork (called "fork") with a fetch config. I did a fetch, and that created the fork/master and fork/branch (where "branch" is the name of the branch I created on github).

I then switched to fork/branch and made some changes. I commited those changes and pushed to my branch on github. I created a PR for those changes on the original project, and those changes were merged.

Now, I want the "master" for my fork to have the latest changes, essentially merging fork/branch to fork/master (in the terms of what I see in Eclipse).

I attempted to do this by first switching to "fork/master". I thought I had done this, and then merged the local branch. This worked, but when I attempted to push these commited changes, I realized that I was actually on the "origin/master" branch, not "fork/master", because the push failed for "insufficient permissions", and it showed the origin project's github url, which made me realize it was going to the wrong "master".

I looked again in Eclipse, and specifically selected "fork/master" in the "Switch to" dialog, and clicked "Checkout".

On the next dialog, which gave me the choice of "Checkout commit" and "Checkout as new local branch" (that first label seems very ambiguous), I selected the latter.

At this point, I get the "Create Branch" dialog, with "Source" set to fork/master, "Branch Name" set to "master", and with an error message up at top saying "Ref refs/head/master already exists".

I guess that's reasonable. At this point, should I give it a different name, like "forkmaster"? Will that create other problems I'll have to deal with?
Re: repo cloned from "origin", now not certain how to properly switch to fork/master [message #1715769 is a reply to message #1715759] Wed, 25 November 2015 23:15 Go to previous messageGo to next message
David M. Karr is currently offline David M. KarrFriend
Messages: 801
Registered: July 2009
Senior Member
Answering my own question (for lack of any other idea), giving it a name like "forkmaster" appeared to work perfectly fine. After that, I was able to merge in my fix branch and push that to the github repo.
Re: repo cloned from "origin", now not certain how to properly switch to fork/master [message #1716746 is a reply to message #1715769] Mon, 07 December 2015 22:51 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
Fully qualified branch names (e.g. refs/heads/master, refs/remotes/origin/foo, refs/remotes/fork/foo) must be unique.
Local branches are, well, local, so their names only need to make sense for you as nobody else will see them.
Previous Topic:EGIT/JGIT Eclipse contribution : how to set breakpoints in JGIT?
Next Topic:Copying notes during rewrite
Goto Forum:
  


Current Time: Sat Apr 20 03:07:15 GMT 2024

Powered by FUDForum. Page generated in 0.02790 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top