Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GIT: update to specific revision

Tags:

git

I checked out a project copy 8 months ago, made lots of changes there. Now, I'd like to take all the new changes for the last 8 months. The amount of changes is overwhelming (tens of thousands of commits). What I'd like to do is to take changes of 1 month at a time, merge with my version, test. If I pull latest the amount of changes/conflicts is overwhelming.

So... I guess it's clear what I'm trying to do, but I have no clue how to do it with GIT (I'm more familiar with svn). I use TortoiseGit on windows. All my local changes I committed to local branch, what do i need to do to pull changes made since I checked out, but not all of them?

thanks

like image 226
Pavel P Avatar asked Aug 29 '11 23:08

Pavel P


1 Answers

A pull is just a combination of a fetch plus a merge. So do a fetch to get all the remote changes down to your local repo, then git log master..origin/master to get a list of all the commits made on origin since your branch diverged, then pick any SHA1 about a month up and git merge SHA1 to pull it into your master branch. Lather, rinse, repeat.

If there are fewer changes on your side, it might be easier to do a git checkout -b upstream origin/master, git log upstream..master, and merge your changes over a month at a time.

I don't know if splitting it up is going to end up being less work in the long run, though. If you merge it all in one chunk, you're not really merging 10,000 commits, you're merging the tips of the branches, which means all those commits essentially get squashed into one big one.

like image 112
Karl Bielefeldt Avatar answered Nov 08 '22 10:11

Karl Bielefeldt