Git skill in IDEA - Changelist

Recently, I got a business license of IntelliJ IDEA from my employer. It’s exciting. Assuming that you change two files in a project with IDEA, and you do not want to commit one of the two due to test locally only. There is an easy way in IDEA: Changelist.

There are two changed files:

  • MainTest: business codes,which would be committed and pushed to the remote repository.
  • TempTest: local test codes, which won’t be committed.

The IDEA commit window like:

To create a new changelist, open menu on Changes and select the New changelist:

Enter a changelist name, for example To Revert:

And then drag files that won’t be committed(TempTest.java) into the new changelist To Revert:

And now,changes that will be committed enter the changelist Changes; changes that won’t be committed can be dragged to To Revert:

Finally,select and commit all files under Changes, and then just push~

(Ends)