Git Workflow
Learning Goals
- Explain the purpose of Git
- Use Git to initialize a repository, add and commit changes, and check the status of changes
Video
Watch this video, and take notes throughout, to learn about the purpose of Git and see the workflow modeled several times.
Stop at the provided prompts to take notes and complete practice exercises as instructed.
Practice
Exercise 1
- Navigate to your home directory.
- If you have a Turing and/or Mod 0 directory, navigate to that (highly recommended)!
- Create a new directory called
to_do
. Inside of that directory, create a file calledtasks.md
. - Initialize Git inside of the
to_do
directory so that we have Git available to track changes. - Before you check the status, predict what it will say. Then, check the current status.
- Add
tasks.md
to the staging area. - Make your first commit in this directory.
- Before you check the status, predict what it will say. Then, check the current status.
- Use VS Code to add three separate tasks to
tasks.md
. - Before you check the status, predict what it will say. Then, check the current status.
- Before you check the difference between your last commit and what the file looks like now, predict what it will say. Then, check the diff.
- Add the changes to the staging area.
- Before you check the status, predict what it will say. Then, check the current status.
- Commit the changes using a properly formatted commit message.
- Before you check the status, predict what it will say. Then, check the current status.
Exercise 2
Before you run each Git command, pause and predict what the output, if any, will be.
- Create a new directory called
code_101
. Inside of that directory, create a file calledlearning_code.md
. - Initialize Git inside of the
code_101
directory so that we have Git available to track change. - Before you check the status, predict what it will say. Then, check the current status.
- Add
learning_code.md
to the staging area. - Commit your work.
- In VS Code, create a header and either a fact or question about Ruby or JavaScript in the
learning_code.md
file. - Add the changes to the staging area.
- Commit the changes using a properly formatted commit message.
- Create a directory inside of
code_101
titledpractice
. Inside of that, create 3 files - you choose the names. - Add some content to each of the three files inside the
practice
directory. - Add and commit your changes.
- Check the status to ensure you have a clean working tree.
Check For Understanding
Please respond to the following questions by adding them to your Mod 0 Gist in a section entitled Git Workflow
- How confident do you feel in your understanding and fluency with the Git workflow?
- What do you still need to practice or learn? How will you do that?
- What part of the Git Workflow is still confusing for you?
Additional Resources (Optional)
- Read this article on Git commit messages
- What’s the use of the staging area in Git? on Stack Overflow