Recording changes (add, commit and push)
This section will guide you through recording changes you make to your repo through the process of adding, staging and pushing 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.
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"
Push the changes to the remote repository
git push origin <github_username>/main
- 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.
Write a short message to describe the changes you made.
Click “Commit”.
Note that you can see the changes made by comparing the green (current version) and the red (old version) highlighted sections.
- Then either push up your changes to the remote directly from the commit box using the green ‘push’ upwards arrow in the top right corner, or close the box and push using the ‘push’ green arrow in the Git window.
- 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.
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”.
- Push the committed changes to the remote repository by clicking the “Push” button in the top-right corner of the PyCharm window.