简体   繁体   中英

GIT: update to specific revision

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

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.

You can always just merge up a couple commits at a time. Just look back and say month 1 is 345bbdkj...., git merge 345bbdkj (just enough of the hash to identify the commit). You can keep on doing that until you get a conflict.

Additionally, you can rebase your repo so your changes are made on top of all these other changes instead of the other way around. Your changes will become a mess no matter what you do here I think though :( 10k+ commits is a lot to deal with.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM