Git Workflow
Use the Git Workflow
-
Create a new file in the
git_test
folder called "gdsc.txt" with the command:touch gdsc.txt
.# Create gdsc.txt using CLI touch gdsc.txt
-
Check the status of your repository by typing
git status
in your terminal. The output shows thatgdsc.txt
is in red, indicating it is not staged.# Check the status of the repo using CLI git status
-
Add
gdsc.txt
to the staging area using the command:git add gdsc.txt
. This prepares the file for the commit.# Stage gdsc and check repo status again using CLI git add gdsc.txt
-
Type
git status
again. The output now showsgdsc.txt
in green, indicating it is in the staging area.# Check repo status again using CLI git status
-
Make a commit with the message "Add gdsc.txt" using the command:
git commit -m "Add gdsc.txt"
. Then, check the status once more. The output should indicate "nothing to commit, working tree clean."# Commit gdsc and check repo status again using CLI git commit -m "Add gdsc.txt" git status
-
Check the commit history using git log:
# Check repo commit history using CLI git log
-
The message "Your branch is ahead of 'origin/main' by 1 commit" indicates that your local branch has one more commit than the remote repository. This will be resolved when you push your changes.