Git topic
Git basics
Learn the Git core commands and concepts you'll use every day.
Look it up and watch it run
From the Animated Git Cheat Sheet
58 commands on this topic, each drawn by git-sim on a small sample repository.
git init
Copy a repository
git clone <url>
Copy only the latest commits
git clone --depth 1 <url>
Clone and check out a branch
git clone -b <branch> <url>
Set your name for commits
git config --global user.name "<name>"
Set your email for commits
git config --global user.email "<email>"
Name the first branch main
git config --global init.defaultBranch main
Choose Git's text editor
git config --global core.editor "code --wait"
The commands, played on a real repository
Pick a command to watch it happen. Each one shows its risk rating; the ones with a full page link to the before and after, whether it is safe, and how to undo it.
How to use this page
- slider / ▶Drag the slider, or press play, to watch the command happen. Before and After jump to either end.
- ← → · spaceStep through a multi-step command; space toggles Before / After.
- APlay or pause the loop (the page opens playing). Any manual input takes over.
- hoverA commit shows its message, author, date and parents, with its history highlighted.
- clickCopies the commit sha.
- ctrl + wheelZoom around the cursor (pinch on a trackpad). Double-click resets the view.
- EscStop playback, reset the view, close this menu.
- shareThe Share button copies a link to this graph, copies it as an image, downloads PNG/SVG/page, or posts it. #before, #after or #step=N in the link pins the state.
Pick a command to watch it happen on a small sample repository.
git
safe
Sample repository: . Drag the slider or press play; hover a commit for its details.
Read the full page
Practice it in Level 1
Try it on your own repository: git-sim
Every command plays on the same repository, so they are easy to compare.
No command matches that. Try a shorter word, or another danger level.
- Safe reads or only adds; nothing is lost
- Caution moves or rewrites things; recoverable from the reflog
- Destructive can lose work for good
Watch them in the git-sim viewer
Each demo plays step by step, with the before and after side by side.
git initgit config user.name <name>git clone <url>git statusgit add <file>git commit -m <message>git log --allgit rm <file>git mv <file> <new-name>git stashgit stash popgit tag <tag>
Every command in one place: the Visual Git command reference.
Learn how it works
Levels on this topic
Watch each command happen, step by step, then pick the right one yourself.
- 1 Level 1 Git overview What a coding project is, how people work on one together, and why they need a system to control the versions.
- 2 Level 2 Init & config What a Git repository is, how Git commands work, and how to create and configure your first repository.
- 3 Level 3 Add & commit Create and edit code files, add their changes to Git's staging area, and commit them onto pages of the scrapbook.
- 4 Level 4 Log & status Use Git's log to see your commit history, and check the status of your working directory.
- 9 Level 9 Tag Tag commits to mark important points in your history, and remove a tag you no longer need.
- 10 Level 10 Stash Stash uncommitted changes to clear your table, then bring them back when you are ready.
- 11 Level 11 Restore Move a staged change back to the working directory, and discard changes you no longer want.
- 16 Level 16 Remove & rename Remove a file Git tracks, rename another, and commit both so the history records them.
Workflow demos
A few commands in a row, the way you'd use them on a real project.
Try it in your own repos
git-sim
See what a command will do to your repo before you run it. It reads the repository and draws the result without changing anything.
git-sim statusgit-sim add <file>git-sim commit -m "message"git-sim stash
It can also pre-flight a risky command as you type it, and follow your repo live while you or an AI agent work in it.
git-dummy
Make a throwaway repo shaped for this topic, then practice on it without risking real work.
git-dummy --scenario messy-worktree --name practicegit-dummy --scenario history --name practice
Then cd practice and run any of the git-sim commands here.
Want to see your repo a whole new way? Devlands turns it into a 3D world you can walk through.














