Possibly related to Git - pulling changes from clone back onto the master
I was working on an ASP.NET project when I discovered I needed to make an "experimental" set of changes which may or may not have been required in the production version.
The obvious thing to do was to create a branch.
However as I was familiar with darcs and svn but not git, I assumed that a clone was the "normal" way to create a branch (I now know that git branch would have been more appropriate.)
I continued to work on the experimental change in the clone and, at the same time, other changes in the original repository.
Since then I have discovered that the experimental changes are desirable in the production version and would like to merge the two change sets.
If I had originally done a branch instead of a clone, this would be trivial. I'm sure it's not too hard to merge between separate repositories, but having looked through the docs I don't think it can be done with a single command (a simple pull does not work.)
I haven't (yet) explicitly configured one repository as a "remote" of the other, but I am guessing this will be part of the solution.
The upstream repository at the time did not use any VCS - it was just a directory full of zips with version numbers appended to the file names.
So I would like to know:
In your original "un-branched" git repository, run these commands:
git remote add name_it_anything /path/to/the/other/git/repository
git fetch name_it_anything
git merge name_it_anything/master
That will merge inn all the changes in nname_it_anything. If you don't want all of them, but just a selection of the commits, you can git log name_it_anything/master to see the list of commits and then git cherry-pick [SHA] for each of the commits you want to merge.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With