-1

I know the GitHub Flow is a good Git workflow that simplified the Git workflow. However, there is one case that it doesn't cover -- How to merge two different git repos from different users. Can the GitHub Flow be of any help, or I have to revert to something completely on command line?

I.e., the GitHub Flow has the assumption that people would cooperate with each other. My question is, what if they don't, what should I do to merge the two or more repos in this case. The repos I'm talking about are:

https://github.com/jasonparekh/go-imap and
https://github.com/dinhviethoa/go-imap/

From https://github.com/jasonparekh/go-imap/network, we can see that they are on different branches, and even on different bases. I.e., there are many many separate forks of the github go-imap project. None of these repositories have been merged back into the original go-imap repository. Regardless what the reasons are behind the situation, I'm trying to pull all those efforts together into a single repository, so that mine will contains all useful patches

How to merge the two or more repos in this case? What if I need to merge in another repos from the above network graph?

mkasberg
  • 16,022
  • 3
  • 42
  • 46
xpt
  • 20,363
  • 37
  • 127
  • 216
  • Let me see if I understand. There are two separate forks of a github project called go-imap. There is different code in each of these repositories that has not been merged back into the original go-imap repository. You want some of the code from each of these repositories and want to know how to get it all since the code is coming from different places? – mkasberg Mar 05 '16 at 16:06
  • 1
    Folks, I was not trying to say that there is anything wrong with "GitHub Workflow", I just simply want to know how to extend it to my particular situation. Those down-votes are really unnecessarily hostile. Please don't be so mean. – xpt Mar 05 '16 at 16:24
  • 1
    Your question is really unrelated to the github workflow. It boils down to a relatively simple question about how to pull code from different forks on github. I think you're being downvoted because your question is long, confusing, and does not have a very accurate title. You might consider editing your original question based on my comment. – mkasberg Mar 05 '16 at 16:29
  • Well, to you it is "*really unrelated to the github workflow*", but to normal joe like me, github workflow is all about how to pull things together from different people. You can still pull patches from forks on github completely from command line, without the help of github workflow, even when the github workflow can help ease things quite a lot. Right? This is exactly my point. You think it is really unrelated, but normal joe like me don't know what you think. – xpt Mar 05 '16 at 16:44
  • In other words, I think I have a very accurate title, because I was hoping that github workflow might be of any help, because the worst case is that I folk the two repos myself and use the github workflow the normal way. Saying that my question is "long, confusing, and does not have a very accurate title" is very subjective. – xpt Mar 05 '16 at 16:54

1 Answers1

0

There are lots of ways to go about getting code from different forks on github. Here's how I would do it:

  1. Clone the original repository. git clone https://github.com/mxk/go-imap.git. The reason for this is that you want to base your master branch on the master branch from that repository so you will continue to get improvements that are made to it via pull requests or otherwise.
  2. Add whatever forks you want with git remote add jasonparekh https://github.com/jasonparekh/go-imap.git. Repeat for other repositories you want code from.
  3. Your local repository has a master branch that is up-to-date with mxk/master. Make sure you fetch all the remotes: git fetch --all. At this point, you can start cherry-picking things you want from other repositories: git cherry-pick abc123. Alternatively, you can merge an entire branch from a remote repository: git merge jasonparekh/v1. This can be a little tricky, and it is possible that you will have to resolve merge conflicts depending what parts of the code changed.

Of course, if you want to work on a local branch that is not master, that's fine, and all the above still applies. You can manage your branches however you like.

mkasberg
  • 16,022
  • 3
  • 42
  • 46