Gerrit - Make & Commit Your Change


Advertisements


When you modify the code in the local file system, you can check for the changes within the directory using the following command.

$ git diff

In the project directory, we will modify some changes in the file called Example/Example.hooks.php and run the above command. We will get the result as shown in the following screenshot.

Gerrit Commit Changes

You can check the changes made to the files or the directory using the following command.

$ git status

Gerrit Commit Changes1

The above command allows to see which changes have been staged, which have not, and which files are not tracked by Git.

Next, you can add the changes in the working directory and update the file in the next commit using following command.

$ git add Example/Example.hooks.php

After adding the file, again run the git status command to review the changes added to the staging area as shown in the following screenshot.

Gerrit Commit Changes2

You can see the difference between the index and your last commit, and what contents have been staged, using the following command.

$ git diff --cached

Gerrit Commit Changes3

You can push the changes to the remote directory from the local repository using the following command.

$ git commit

When you run the above command, it will ask to add the commit message for your changes. This message will be seen by other people when you push the commit to the other repository.

Gerrit Commit Changes4

Add the commit message and run the command again as git commit, which will display the commit message as shown in the following screenshot.

Gerrit Commit Changes5

Advertisements