Interactive Git Commands Cheatsheet

Developer Utilities

Comprehensive, searchable Git cheatsheet covering branch, commit, undo, stash, remote, and rebase operations.

Initialize Git Repository

basic

Creates a new empty Git repository in the current folder.

git init

Check Status

basic

Displays the status of tracked, modified, and staged files.

git status

Stage All Changes

basic

Stages all modifications and untracked files for the next commit.

git add .

Record Commit

basic

Records staged snapshot with a descriptive message to history.

git commit -m "feat: your descriptive message"

Create & Switch Branch

branch

Creates a new branch and checks it out immediately.

git checkout -b feature/new-feature

List All Branches

branch

Lists all local and remote branches in the repository.

git branch -a

Merge Branch

branch

Merges the specified branch into the currently active branch.

git merge feature/new-feature

Delete Local Branch

branch

Deletes a merged local branch (use -D to force delete).

git branch -d branch-name

Add Remote Origin

remote

Links a remote repository URL to the local repository as origin.

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

Pull Changes from Remote

remote

Fetches and merges the latest commits from remote origin into local branch.

git pull origin main

Push to Remote

remote

Pushes local commits to the remote branch and sets upstream tracking.

git push -u origin main

Undo Last Commit (Keep Files)

undo

Rolls back the last commit while keeping modified code staged.

git reset --soft HEAD~1

Unstage File

undo

Removes a file from the staging area without discarding modifications.

git restore --staged <file>

Discard All Local Changes

undo

Discards all uncommitted changes in tracked files permanently.

git checkout -- .

Stash Uncommitted Changes

stash

Saves dirty working directory state temporarily for later use.

git stash

Apply & Drop Stash

stash

Restores the most recently stashed changes back to your working tree.

git stash pop

Cherry-pick Commit

advanced

Applies the exact changes from a specific commit into the current branch.

git cherry-pick <commit-hash>

Amend Last Commit

advanced

Modifies the most recent commit message or combines newly staged files into it.

git commit --amend -m "new message"

Pretty Git Log Graph

advanced

Visualizes commit history and branches in a concise terminal graph.

git log --oneline --graph --decorate
Independent Project Patronage

Love ToolsApp? Buy Us a Coffee

ToolsApp operates 100% client-side with zero subscriptions and zero data tracking. We believe essential digital tools should remain free and accessible to everyone. Your coffee donations help us keep servers running and build new tools!

100% Client-SideFree For Everyone

How to Use Interactive Git Commands Cheatsheet

1

Select Category

Pick Basics, Branching, Undoing, or Stash operations.

2

Find Scenario

Search for what you want to achieve with Git.

3

Copy Command

Copy the command directly to your terminal.

Privacy Guarantee:All computations, transformations, and file processing occur 100% locally in your browser via client-side JavaScript. Your sensitive data is never uploaded or logged on any remote server.

User Reviews & Feedback

Share your experience anonymously. Moderated automatically by AI.

5.0
0 reviews
5 / 5
0/500
Powered by Groq AI automated content moderation

Approved Reviews (0)

Loading reviews...