Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Vinge1718/d3aaba4a81d72a9bc26d054162406ff8 to your computer and use it in GitHub Desktop.
Save Vinge1718/d3aaba4a81d72a9bc26d054162406ff8 to your computer and use it in GitHub Desktop.
Git Basics Exercise - Answers
Now that you have learned the basics of Git workflow, try running through this a couple of times on your own:
Create a folder called learn_git_again. mkdir learn_git_again
cd into the learn_git_again folder.cd learn_git_again
Create a file called third.txt. touch third.txt
Initialize an empty git repository. git init
Add third.txt to the staging area.git add third.txt
Commit with the message "adding third.txt".git commit -m "adding third.txt"
Check out your commit with git log.git log
Create another file called fourth.txt.touch fourth.txt
Add fourth.txt to the staging area.git add fourth.txt
Commit with the message "adding fourth.txt"git commit -m "adding fourth.txt"
Remove the third.txt file. rm third.txt
Add this change to the staging area. git add third.txt
Commit with the message "removing third.txt". git commit -m "removing third.txt"
Check out your commits using git log. git log
Change your global setting to core.pager=cat - you can read more about that here. git config --global core.pager "cat"
Write the command to list all of the global configurations for git on your machine. You can type git config --global to find out how to do this - git config --global --list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment