git init made my-first-project a repositorygit config --global user.email set?ls to see where you are, or start fresh: mkdir my-first-project, cd my-first-project, git init..git| commit | the ID, a long hash |
| Author | from your git config |
| Date | when you committed |
| Message | what changed |
todo.txt with one lineecho "Buy milk" > todo.txtgit add todo.txtgit commit -m "Add todo list"git log --oneline| Weak | "update" |
| Weak | "final fix" |
| Clear | "Add todo list" |
-m. If it is Vim (full screen, no menus), quit with:git config --global lines, then commit again.| master | the real house, always working |
| feature-branch | the mock-up, try anything |
| Command | What it does |
|---|---|
| git branch feature-branch | Creates a branch. You do not move onto it. |
| git checkout feature-branch | Moves you onto that branch. git switch also works. |
| git branch | Lists branches. * marks the one you are on. |
| git merge feature-branch | Brings that branch's commits into the branch you are on. |
git branch about-page then git checkout about-pageecho "About us" > about.txt, git add about.txt, git commit -m "Add about page"git checkout master then git merge about-pagegit log --onelinegit add the file, then git commit.my-first-project. We use it next.git stash puts it in a drawer, clears your desk, and lets you switch. Later you take it back out.| Command | What it does |
|---|---|
| git stash | Put unfinished changes in the drawer. Desk is clean. |
| git stash list | See everything in the drawer. |
| git stash pop | Take the newest one back out and remove it from the drawer. |
| git stash apply | Bring it back but keep a copy in the drawer. |
.git folder. That is the repository.