1

I work on a lot of legacy code that people attempt to rewrite. Sometimes these rewrites are done without tests and something doesn't make sense to me in the new branch. At that point, I like to switch to the old branch and find what the code used to be and see if a regression was introduced.

The way I do this is to stash my current changes, check out the new branch, look at the same file in the old branch (this file may have a different name between both branches, a name I don't know off the top of my head), maybe save it somewhere else, and switch back to the state I was in before all those steps to see the differences.

This is a lot of back and forth and I'm wondering if git itself provides better tools so I can skip the steps I'm using.

I develop in Intellij IDEA, but I don't know if that's relevant.

I'm not interested in downloading a git GUI for this, but if intellij provides something out of the box (or a plugin), I'd be fine with that.

Daniel Kaplan
  • 62,768
  • 50
  • 234
  • 356
  • Most git clients will let you explore and compare commits without having to check out. I know Git Extensions and EGit do. – shmosel Dec 27 '17 at 00:24
  • Have you tried using a GUI tools like tortoise git? There is a diff branch option that will allow you to compare branches side-by-side. It's pretty neat. – Dan Dec 27 '17 at 00:24

0 Answers0