Git Command Reference
The Git commands covered in the course, with examples that run in the practice terminal.
25 of 25
| Command | Group | Description |
|---|---|---|
| git init | Setup | Starts a repository in the current folder. |
| git status | Basics | Shows what has changed. |
| git add | Basics | Stages changes for the next commit. |
| git commit -m | Basics | Saves staged changes with a message. |
| git commit -am | Basics | Stages tracked changes and commits. |
| git log | History | Shows the commit history. |
| git log --oneline | History | Short history, one line per commit. |
| git diff | History | Shows unstaged changes. |
| git diff --staged | History | Shows staged changes. |
| git branch | Branches | Lists or creates branches. |
| git branch -d | Branches | Deletes a merged branch. |
| git checkout | Branches | Switches branches. |
| git checkout -b | Branches | Creates a branch and switches to it. |
| git switch | Branches | Switches branches (modern form). |
| git merge | Branches | Brings another branch into the current one. |
| git restore | Undo | Discards changes in a file. |
| git restore --staged | Undo | Unstages a file. |
| git reset --soft | Undo | Undoes commits, keeps changes staged. |
| git reset | Undo | Undoes commits, keeps changes unstaged. |
| git reset --hard | Undo | Undoes commits and discards changes. |
| git stash | Undo | Shelves uncommitted changes. |
| git stash pop | Undo | Restores the newest stash. |
| git stash list | Undo | Lists stashes. |
| git remote add | Remote | Connects a remote repository. |
| git push | Remote | Sends commits to a remote. |