Let’s create your first repository and commit.
- Create a folder and init Git
- mkdir hello-git && cd hello-git
- git init
- Create a file and check status
- echo “Hello” > readme.txt
- git status
- Stage and commit
- git add readme.txt
- git commit -m “Add readme”
- 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