Reputation: 6365
Some changes were made in git between hash A and hash B (the branch latest is in Z - thousands of commits later). I'd like to have the HEAD (my local one) point to hash A and have in my working directory all changes that were made between A and B.
Why? Because git diff is inconvenient and I'd rather work with the diff tool my IDE (IntelliJ IDEA) has. But for this I need to convince the IDE that I have changed files - hence the request.
Upvotes: 3
Views: 4543
Reputation: 6365
I actually found a way:
git checkout <hash A>
git diff –patch <hash A> <hash B> > patch.patch
patch –p1 –N < patch.patch
A coworker also told me that I could've used
git checkout <hash A>
git merge --squash <hash B>
instead - but I didn't test it yet.
Upvotes: 5
Reputation: 1329492
You could:
git clone
your local repo and reset it to hashB
(see "Git clone particular version of remote repository")git reset hashA
within your local repoHEAD
.Upvotes: 1