Committing the changes

You moved the credentials out of the code repository and verified that the robot still works. You visually reviewed your changes and saw that they look fine. You feel confident about the changes. They will improve the robot! It is time to commit.

Preparing for commit

In the root of your robot project, run git add . to add all the created and modified files:

git add .

See git add command documentation for more information.

Running git status shows that the changes are now ready to be committed:

git status
On branch remove-credentials
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    new file:   devdata/env.json
    modified:   tasks.robot

If you still want to review your changes before committing, you can run git diff --staged.

Commit!

Provide a message describing the changes and commit by running git commit -m 'Move credentials to vault':

git commit -m 'Move credentials to vault'
[remove-credentials 39bdae6] Move credentials to vault
 2 files changed, 8 insertions(+), 2 deletions(-)
 create mode 100644 devdata/env.json

Visual Git clients provide you a user interface for writing the message and doing the commit.

Running git status now shows nothing new to commit (since you just committed):

git status
On branch remove-credentials
nothing to commit, working tree clean

Viewing the log

You can view a log of the changes by running git log:

git log
commit 39bdae6e4b3825d7466e5881f6c7f67f4e7e5835 (HEAD -> remove-credentials)
Author: Jani Palsamäki <[email protected]>
Date:   Mon Aug 24 08:10:33 2020 +0300

    Move credentials to vault

What we learned

  • You can prepare files and directories for committing using git add ..
  • You provide a message and commit the changes using git commit -m 'Message describing the changes'.
  • You can view a log of the changes using git log.
  • Visual Git clients provide a user interface for all the operations.