Skip to the content.

Git Commands Cheatsheet

Basics

git init                    # Initialize a new repo
git clone <url>             # Clone a repository
git status                  # Check working tree status
git add <file>              # Stage changes
git commit -m "message"     # Commit staged changes

Branching

git branch                  # List branches
git branch <name>           # Create a branch
git checkout <branch>       # Switch branches
git merge <branch>          # Merge a branch
git branch -d <name>        # Delete a branch

Remote

git remote -v               # List remotes
git push origin <branch>    # Push to remote
git pull                    # Fetch and merge
git fetch                   # Fetch without merging