Git get changes between hash A and B in working directory

Some changes were made in git between hash A and hash B (the last branch is in Z - thousands of commits later). I would like HEAD (my local one) to point to hash A and have in my working directory all the changes that were made between A and B.

Why? Since git diff is inconvenient, and I would prefer to work with the diff tool that has my IDE (IntelliJ IDEA). But for this I need to convince the IDE that I modified the files - hence the request.

+3
source share
2 answers

I really found a way:

git checkout <hash A>
git diff –patch <hash A> <hash B> > patch.patch
patch –p1 –N < patch.patch

The employee also told me that I could use

git checkout <hash A>
git merge --squash <hash B>

instead - but I have not tested it yet.

+5
source

You can:

  • git clone reset hashB (. Git )
  • git reset hashA
  • : Git IDEA , HEAD.
+1

All Articles