Make Local Git Repository Changes
Let's make a change to one of the files in our local Git repository and see how Git reacts to that change.
Append the README.md File
-
From the Docker Container prompt, view the status of your local Git repository with the following command:
# Display status information for the current git repository git status
-
Notice your working branch is branch3 and that you have no changes to commit (indicated by the
nothing to commit
output.
-
Write a new line to the README.md file with the following command:
# Append a new line of text ('This is a new line...'') to the file 'README.md' echo 'This is a new line in the README.md file' >> README.md
-
View the changes between the copy of README.md in the working directory and the local Git repository with the following command:
# Display changes between the working and committed files within the git repository git diff
-
Notice the
+
character next to the last line in thegit diff
output. This indicates the a change between the README.md file in the working directory and the copy of README.md which is already in (committed to) the local Git repository.
-
View the of your local Git repository with the following command:
# Display status information for the current git repository git status
-
Notice the README.md file in the section,
Changes not staged for commit
.
We made a change to one of the files in our working directory and next up is the process to move files from the working directory, to the staging area, and to the local repository (HEAD). Click the link below to continue:
Next Section > Make Local Git Repository Changes With Atomic Commits