Let’s create your first repository and commit.

  1. Create a folder and init Git
  • mkdir hello-git && cd hello-git
  • git init
  1. Create a file and check status
  • echo “Hello” > readme.txt
  • git status
  1. Stage and commit
  • git add readme.txt
  • git commit -m “Add readme”
  1. Inspect history
  • git log —oneline
  • git show HEAD

Concepts

  • Working directory: your current files
  • Staging area (index): what will go into the next commit
  • HEAD: your current commit (where you are)

Checklist

  • Repository initialized
  • First file added and committed
  • You can read git log and show HEAD