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?
There are lots of ways to go about getting code from different forks on github. Here's how I would do it:
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.git remote add jasonparekh https://github.com/jasonparekh/go-imap.git
. Repeat for other repositories you want code from.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.