Recording changes (add and commit)

This section will guide you through recording changes you make to your repo through the process of adding and staging files.

These steps help you manage and track changes in your project, making collaboration and version control efficient and reliable.

Having created your own branch, follow the instructions below to make and record changes in your repo.

Edit your git-academy-log file
  • Put an x inside the brackets for the “Clone git-academy-sandbox” and “Create a new branch in GitHub (<github_username>/main)”.

  • Save the file.

  • Check which files have changed by entering this command in Git Bash:

    git status

  • Stage the changes you want to commit by using one of the commands below.

    • To add changes to one file at a time:

      git add git-academy-log.md

    OR

    • To add all changes:

      git add .

  • Commit changes with a message by entering:

    git commit -m "Checked clone sandbox and make new branch tasks"

  • In the Git panel of RStudio (see image below), tick the files you want to record the changes for.
  • Click the commit button. It has a tick mark on two sheets of paper.

Higlighting the Commit button and an example of ticking changes in the Git panel in RStudio.

  • Write a short message to describe the changes you made.

  • Click “Commit”.

Highlighting the commit message section and the Commit button in the RStudio: Review Changes pop up window that appears after completeing the last step.

Note that you can see the changes made by comparing the green (current version) and the red (old version) highlighted sections.

  • Click on the branches drop down menu at the top of the screen and click “Commit”.

OR

  • Click on the symbol that shows a circle flanked by two lines in the sidebar as shown in the image below.

Highlighting the two ways to open the commit window.

  • In the “Commit” pop up window, tick the files you wish to record changes for if they’re not already ticked.

  • Write a short message to describe the changes you made.

  • Click “Commit”.

Highlighting the commit message section and the Commit button in the Commit pop up window that appears after completeing the last step.

Back to top