Git commands
Know exactly what changed — and recover from anything, without rewriting shared history.
Everyday version control, from clone to recovery
What you'll take away
Review your work before every commit, not after it
Undo mistakes with the least destructive command
Keep branches clean, synced and easy to merge
36 entries · click a command to copy
Repository setup
Start a new repository or connect to an existing one.
Create a new local Git repository in the current folder.
e.g. git init my-project
Copy a remote repository, including its history, into a new folder.
e.g. git clone https://github.com/org/repo.git
Set the author name recorded on your commits.
Set the author email recorded on your commits.
Inspect and compare
Understand what changed before you commit.
Show untracked, staged and modified files.
Tip: Run this constantly — it is the safest habit in Git.
Show unstaged changes as a patch.
Show changes that are staged for the next commit.
Compact commit history with a branch diagram.
Inspect a specific commit and its patch.
See which commit last changed each line of a file.
Stage and commit
Build a clean, reviewable history.
Stage one file for the next commit.
Stage all changes in the current directory.
Tip: Check git status first to avoid staging secrets or build output.
Record staged changes with a short message.
e.g. git commit -m "fix: handle empty cart"
Stage tracked modifications and commit in one step (does not add new files).
Mark a commit with a release tag.
Branches and merging
Work on changes in isolation, then combine them.
List local branches; the current one is marked with *.
List local and remote-tracking branches.
Create a new branch from the current commit.
Move to another branch and update the working tree.
Tip: git checkout <name> is the older equivalent.
Create and switch to a new branch in one command.
Combine another branch's history into the current branch.
Replay your commits on top of another branch for a linear history.
Tip: Do not rebase commits that others have already pulled.
Delete a fully merged local branch.
Remotes and sync
Exchange commits with a shared repository.
List configured remotes and their URLs.
Attach a remote repository under the name origin.
Download remote refs and objects without changing your files.
Fetch and merge the tracked upstream branch.
Push a branch and set it as the upstream for future pulls.
Send local commits to the configured upstream branch.
Undo and recovery
Fix mistakes with the least destructive option first.
Discard unstaged changes in a file.
Unstage a file while keeping your working changes.
Create a new commit that reverses an earlier commit.
Tip: Preferred for shared branches because it rewrites nothing.
Move HEAD back one commit but keep changes staged.
Move HEAD back and discard all changes after it.
Tip: Destructive — only use on commits nobody else has.
Shelve current changes so you can switch tasks.
Restore the most recently stashed changes.
This sheet was curated from reference material in the Skyware AI technical library (Git command cheat sheet (Brij Kishore Pandey)). Command syntax is factual; explanations, grouping and examples were written by our engineering team. Always verify syntax against your tool or database version.
More cheat sheets
SQL data cleaning
A task-oriented SQL reference for string cleanup, NULL handling, type conversion, dates, aggregation and deduplication.
OpenPandas essentials
The core Pandas operations you reach for daily, organised by task with short, copyable examples.
OpenPySpark handbook
A structured quick reference for PySpark setup, DataFrame operations, SQL, writing data and model training — distilled from the full guide.
Open