ReadmeBuddy LogoReadmeBuddy

Master Git Commands

Learn Git from beginner to advanced with our comprehensive command reference, interactive examples, and step-by-step tutorials.

50+ Commands
Beginner to Advanced
Interactive Examples
Learning Progress
Track your Git learning journey
Overall Progress0%

Git Cheat Sheet

Download our comprehensive Git cheat sheet

Interactive Tutorial

Try our hands-on Git tutorial

GitHub Documentation

Official Git documentation

Practice Repository

Clone and practice with our sample repo

Setup & Configuration
beginner
git config --global user.name 'Your Name'

Set the name that will be attached to your commits and appears in the commit history.

Setup & Configuration
beginner
git config --global user.email 'youremail@example.com'

Set the email address that will be attached to your commits for identification.

Setup & Configuration
beginner
git config --global init.defaultBranch main

Set the default branch name to 'main' for all new repositories you create.

Setup & Configuration
intermediate
git config --global core.editor 'code --wait'

Set VS Code as your default Git editor for commit messages and merge conflicts.

Basic Commands
beginner
git init

Initialize a new, empty Git repository in the current directory. Creates a .git folder.

Basic Commands
beginner
git clone https://github.com/user/repo.git

Create a local copy of a remote repository. Downloads all files and commit history.

Basic Commands
beginner
git status

Show the working tree status including untracked, modified, and staged files.

Daily Workflow
beginner
git add <file>

Add file contents to the staging area. Use 'git add .' to add all changes.

Daily Workflow
beginner
git commit -m 'Your commit message'

Record changes to the repository with a descriptive message. Be specific and clear.

Daily Workflow
beginner
git push

Update the remote repository with your committed changes from the current branch.

Daily Workflow
beginner
git pull

Fetch changes from the remote repository and merge them into your current branch.

Daily Workflow
intermediate
git fetch

Download objects and refs from another repository without merging changes.

Branching & Merging
beginner
git branch

List all local branches. Add '-r' for remote or '-a' for all branches.

Branching & Merging
beginner
git branch <branch-name>

Create a new branch with the specified name without switching to it.

Branching & Merging
beginner
git checkout <branch-name>

Switch to an existing branch. Use '-b' to create and switch in one step.

Branching & Merging
intermediate
git switch <branch-name>

Modern way to switch branches. More intuitive than checkout for branch switching.

Branching & Merging
intermediate
git merge <branch-name>

Join the specified branch's history into the current branch.

Branching & Merging
advanced
git rebase <branch-name>

Re-apply commits from your current branch onto the tip of another branch.

Undoing Changes
intermediate
git commit --amend

Modify the most recent commit. Useful for fixing typos or adding forgotten changes.

Undoing Changes
intermediate
git reset HEAD <file>

Unstage a file, but preserve its content in the working directory.

Undoing Changes
intermediate
git reset --soft HEAD~1

Undo the last commit but keep the changes staged for recommitting.

Undoing Changes
advanced
git reset --hard HEAD~1

DANGEROUS: Discard the last commit and all changes. Use with extreme caution!

Undoing Changes
intermediate
git revert <commit-hash>

Create a new commit that undoes the changes of a previous commit safely.

Inspecting History
beginner
git log

Show the commit history. Use '--oneline' for a compact view.

Inspecting History
intermediate
git log --graph --oneline --decorate

Display the commit history as a visual graph with branch information.

Inspecting History
intermediate
git diff

Show changes between commits, working tree, etc. Use '--staged' for staged changes.

Inspecting History
intermediate
git show <commit-hash>

Show metadata and content changes of the specified commit.

Inspecting History
advanced
git blame <file>

Show what revision and author last modified each line of a file.

Working with Remotes
beginner
git remote -v

List all remote repositories with their URLs.

Working with Remotes
beginner
git remote add origin <url>

Add a new remote repository with the name 'origin'.

Working with Remotes
beginner
git push -u origin main

Push a local branch to a remote repository and set it as the upstream branch.

Working with Remotes
intermediate
git remote remove <name>

Remove a remote repository from your local Git configuration.

Ready to Generate Your README?

Now that you've learned Git, create a professional README for your repository!

Generate README Now