Skip to content

Instantly share code, notes, and snippets.

@jogren
Last active March 23, 2019 15:12
Show Gist options
  • Save jogren/fe2e5ad4889d81db95f152f6c3784183 to your computer and use it in GitHub Desktop.
Save jogren/fe2e5ad4889d81db95f152f6c3784183 to your computer and use it in GitHub Desktop.
Get to know Git with this Beginner's Guide!

Understanding the Git Workflow

To begin lets start with 5 common git commands that you're sure to use:

  • git init
  • git add filename
  • git commit -m message
  • git status
  • git diff

Follow these simply steps to practice the Git Workflow:

  1. Add a file in the Terminal:
touch animals.txt
  1. Initialize git:
git init
  1. Modify the file:
echo "Monkeys are my favorite animal" >> animals.txt
  1. Add the file to the Staging Area:
git add animals.txt
  1. Commit your changes:
git commit -m "Add favorite animal"
  1. Repeat steps 3 through 5, but this time add your second favorite animal (when commiting, be sure to add a new message). Check the status between each steps using the git status command, and check the difference after you modify the file using git diff

For the visual learners of the group, please refer to the following image:

lifecycle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment