Daniel Kaplan
Daniel Kaplan

Reputation: 67360

Can intellij show me the changes of the last x commits as if they were just made?

I am about to have an over-the-shoulder code review but my changes consist of multiple commits. It would be convenient if intellij-idea could show them all to me as if they were new changes because they would be a lot easier to find that way.

Does intellij have a built in way to do the equivalent of this:

git checkout -b temp-for-code-review
git reset --soft HEAD~x #x is a number of commits I want reviewed

If I do this in git, intellij will show changes exactly the way I want, but I'm wondering if there's a way to do this built into intellij.

Upvotes: 14

Views: 5166

Answers (2)

Makoto
Makoto

Reputation: 106430

Navigate to the Changes menu (Command + 9 or Ctrl + 9), and highlight all of the commits that you want to review. Then, diff the highlighted changes (Ctrl + D or Command + D).

This has the advantage of not needing to spin up another branch, or allowing you to show the changes that you have truly done and commited locally on whatever branch you're on.

Upvotes: 5

acanby
acanby

Reputation: 2993

You can checkout a new branch in the usual way from the bottom right selector:

Git checkout new branch

And then do a soft reset from the menu VCS > Git > Reset HEAD. You can then choose the options to do what you'd like in the command line, eg:

Git Reset Head

Upvotes: 8

Related Questions