Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
In this exercise, the main goal will be to configure our project in IntelliJ with Git so we can use version control
on our source code, and write unit tests to ensure that our ephemeral database works correctly.
Git
Initialize a git repository inside your IntelliJ project. You can do this either using the command line or using
IntelliJ’s GUI by going into the menu VCS -> Enable Version Control Integration.
Now the menu VCS will have more options:
Currently the git repository created by IntelliJ is empty.
Every file in the project tree will have a color determining its status within the code repository. Files in red are
files that have been modified since the last commit. Since our repository doesn’t contain any file, they appear
in red.
When right clicking on a file, we also have access to a sub-menu VCS providing specific actions for that file.
Before committing, we need to tell Git which files we want to commit.
Ideally, we should only add files that are needed for someone else to compile the project. For example, it is not
necessary to add and commit binaries produced by the IDE. For us, we only need to commit the source files
(.java files) and Maven’s pom.xml which contains the instructions to build the project.
The files added will appear in green and your tree structure should look like this:
You can now commit your changes by going into VCS -> commit or using the keyboard shortcut Ctrl + K:
The left panel of IntelliJ should change and show you the list of files that will be committed in green and those
that won’t in red (1 in the screenshot below). At the bottom there will be a text field in black (2 in the
screenshot below) where you can enter a commit message. You should enter a message that describes what
your change (i.e. commit) does. Once done you can click on the commit button (3 in the screenshot below).