# Login to Calgary.
ssh cf2024@calgary.cs.washington.edu
# Clone my personal git repository.
git clone git@gitlab.cs.washington.edu:cse374-25su-students/cse374-25su-cf2024.git
ls
cd cse374-25su-cf2024
ls
git status
# Create a README file and add it to the staging area
touch README.md
vim README.md
# Add: "# This is my README file!"
# Check status – file is untracked
git status
# Stage the file
git add README.md
# Check status – file is staged
git status
# Commit the change with a message
git commit -m "Added README.md"
# Status shows we're ahead by 1 commit (nothing on GitLab yet)
git status
# Push the commit to the remote repo and set upstream tracking on origin master
git push -u origin master
# Now the README appears on GitLab
# Making more changes
# Edit README.md again and add a smiley face
vim README.md
# Add: ":)"
# View the diff (what changed in the working directory)
git diff README.md
# Stage the updated README
git add README.md
# Create another untracked file
touch file1.txt
# Status shows README is staged; file1.txt is untracked
git status
# Commit with no -m flag to demonstrate writing a multi-line message
git commit
# Message:
# Added smiley face
#
# Because I'm feeling happy today
# Push to update remote repo
git push
# file1.txt is still untracked and not pushed
git status
# Adding more files
touch file2.txt
# Status shows file1.txt and file2.txt are both untracked
git status
# Add both files at once using dot (.)
git add .
# Status shows both new files are staged
git status
# Modify README again using echo
echo "=) ;) <3" >> README.md
# Status shows README is modified, but not staged
git status
# Stage all changes
git add .
# View the diff of what's already staged
git diff --cached
# Unstage README if we only want to commit the new .txt files
git restore --staged README.md
# Status now shows only the text files are staged
git status
# Commit the new text files
git commit -m "Add file1.txt and file2.txt"
# Push to GitLab
git push
# View full commit history
git log
# Bonus: Reverting a Commit
git add README.md
git commit -m "Add more smilies to README"
git push
# Now, revert the previous commit
git log
# Copy the hash of the commit to revert
git revert <commit-hash>
# Git opens an editor with the default revert message
# Save and close
# Push the revert commit
git push
# Confirm the revert commit appears in log
git log