PureTools

Git Commands Cheatsheet

Free Git commands cheatsheet. Categorized reference with descriptions, examples, and common workflows.

Setup & Config

git init

Initialize a new repository

git clone <url>

Clone a repository

Example: git clone https://github.com/user/repo.git

git config --global user.name <name>

Set global username

Example: git config --global user.name "John Doe"

git config --global user.email <email>

Set global email

Example: git config --global user.email "john@example.com"

git config --list

List all config settings

Basic Snapshotting

git status

Show working tree status

git add <file>

Stage a file

Example: git add index.html

git add .

Stage all changes

git commit -m <msg>

Commit staged changes

Example: git commit -m "Add feature"

git commit --amend

Amend the last commit

git diff

Show unstaged changes

git diff --staged

Show staged changes

git reset <file>

Unstage a file

git rm <file>

Remove a file from tracking

git mv <old> <new>

Rename/move a file

Branching & Merging

git branch

List branches

git branch <name>

Create a new branch

Example: git branch feature/login

git branch -d <name>

Delete a branch

git checkout <branch>

Switch to branch

git checkout -b <branch>

Create and switch to branch

git switch <branch>

Switch to branch (modern)

git switch -c <branch>

Create and switch (modern)

git merge <branch>

Merge branch into current

git rebase <branch>

Rebase current onto branch

git cherry-pick <hash>

Apply a specific commit

Remote

git remote -v

List remotes with URLs

git remote add <name> <url>

Add a remote

Example: git remote add origin https://github.com/user/repo.git

git fetch

Download remote changes

git pull

Fetch and merge remote changes

git push

Push commits to remote

git push -u origin <branch>

Push and set upstream

git push --force

Force push (use with caution!)

History & Inspection

git log

Show commit history

git log --oneline

Compact log

git log --graph

Show branch graph

git show <hash>

Show commit details

git blame <file>

Show who changed each line

git reflog

Show reference log

Stashing

git stash

Stash current changes

git stash pop

Apply and remove latest stash

git stash list

List all stashes

git stash apply

Apply latest stash (keep it)

git stash drop

Remove latest stash

git stash clear

Remove all stashes

Undoing Changes

git restore <file>

Discard working directory changes

git restore --staged <file>

Unstage a file

git reset --soft HEAD~1

Undo last commit, keep changes staged

git reset --mixed HEAD~1

Undo last commit, keep changes unstaged

git reset --hard HEAD~1

Undo last commit, discard changes

git revert <hash>

Create a commit that undoes a commit

Tags

git tag

List tags

git tag <name>

Create lightweight tag

Example: git tag v1.0.0

git tag -a <name> -m <msg>

Create annotated tag

git push --tags

Push all tags to remote

What is it?

Git Commands Cheatsheet is a free online tool that runs entirely in your browser. Free Git commands cheatsheet. Categorized reference with descriptions, examples, and common workflows. No data is sent to any server — all processing happens locally on your device, ensuring complete privacy and security. Whether you're a developer, designer, student, or professional, this tool saves you time by providing instant results without requiring any software installation or account creation.

How to use

Using Git Commands Cheatsheet is straightforward. Simply enter or paste your data in the input field, configure any available options, and click the action button to process. The result appears instantly in the output area. You can copy the result to your clipboard with one click. If you need to start over, just clear the input and try again. The tool accepts a wide range of inputs and handles edge cases gracefully.

When to use

Git Commands Cheatsheet is useful in many everyday scenarios. Developers use it during coding sessions to quickly process data without leaving the browser. It's also perfect for one-off tasks where installing a dedicated application would be overkill. Students and learners find it helpful for understanding how the underlying process works. Since it's web-based, you can use it from any device — desktop, laptop, tablet, or phone — without any setup.

Frequently Asked Questions

Is Git Commands Cheatsheet free to use?
Yes, Git Commands Cheatsheet is completely free with no usage limits, no account required, and no ads that block functionality. All features are available immediately.
Is my data safe when using Git Commands Cheatsheet?
Absolutely. All processing happens directly in your browser using JavaScript. Your data never leaves your device and is never sent to any external server. You can verify this by checking your browser's network tab.
Does Git Commands Cheatsheet work on mobile devices?
Yes, the tool is fully responsive and works on all modern browsers including Chrome, Firefox, Safari, and Edge on any device — desktop, tablet, or smartphone.
Do I need to install anything to use Git Commands Cheatsheet?
No installation is needed. Git Commands Cheatsheet runs entirely in your web browser. Just open the page and start using it immediately. There's no signup, no download, and no browser extension required.

Related Tools