Explore Git Commands

Each command is an animated lesson, and each option a short demo — or an explanation when it cannot be shown honestly.

72 commands · 275 options

/
Sort:

✦ Setup & Creating Projects

YOUR FILES — ONE FILE, THREE PLACESWorking diryour diskStagingnext commitHEADlast commitadd ›commit ›GITUALIZEYOUR REPOSITORY — .git on your laptop6558592Initial commit6558592b1fd41e6afb976bdbbda4151160fd08ac Initial commitmainmain: a movable label on a commitHEADHEAD → the branch you are onREADME.mdunchangedapp.jsunchangedindex.htmlunchangedv1v1v1v1v1v1v2v2v2HEAD → main → 6558592 “Initial commit”

git init

Turn a folder into a Git repository

Create an empty Git repository

Setup & Creating Projects · 1 optionsOpen →
YOUR FILES — ONE FILE, THREE PLACESWorking diryour diskStagingnext commitHEADlast commitadd ›commit ›GITUALIZE☁ ORIGIN — github.com/acme/shop (another repository)YOUR REPOSITORY — .git on your laptop2e039acAdd homepage2e039ac897849007af489a58ee9eec107a21974e Add homepageb272b3aSet up projectb272b3abaca08f2f1c56c0562679f66a61035535 Set up project129c2dbInitial commit129c2db06bfe68f8469dc82e6e05d1c03d1f768c Initial commit2e039acAdd homepage2e039ac897849007af489a58ee9eec107a21974e Add homepageb272b3aSet up projectb272b3abaca08f2f1c56c0562679f66a61035535 Set up project129c2dbInitial commit129c2db06bfe68f8469dc82e6e05d1c03d1f768c Initial commitmainmain: a movable label on a commitorigin/mainorigin/main: your LOCAL bookmark of where origin's branch was at your last fetch/pushHEADHEAD → the branch you are onmainmain: as it exists ON originREADME.mdunchangedapp.jsunchangedindex.htmlunchangedv1v1v1v1v1v1v2v2v2HEAD → main → 2e039ac “Add homepage”

git clone

Download a project from GitHub

Copy a repository into a new folder

Setup & Creating Projects · 2 optionsOpen →
YOUR FILES — ONE FILE, THREE PLACESWorking diryour diskStagingnext commitHEADlast commitadd ›commit ›GITUALIZEYOUR REPOSITORY — .git on your laptop2e039acAdd homepage2e039ac897849007af489a58ee9eec107a21974e Add homepageb272b3aSet up projectb272b3abaca08f2f1c56c0562679f66a61035535 Set up project129c2dbInitial commit129c2db06bfe68f8469dc82e6e05d1c03d1f768c Initial commitmainmain: a movable label on a commitHEADHEAD → the branch you are onREADME.mdunchangedapp.jsunchangedindex.htmlunchangedv1v1v1v1v1v1v2v2v2HEAD → main → 2e039ac “Add homepage”

git config

Read and change Git settings

Get and set Git settings

Setup & Creating Projects · 3 optionsOpen →

git version

Which Git is installed

Show the installed Git version

Setup & Creating Projects · 1 optionsOpen →

git help

Find the right command

Show help for Git and its commands

Setup & Creating Projects · 3 optionsOpen →

git bugreport

Collect information for a Git bug report

Setup & Creating Projects · 0 optionsOpen →

git diagnose

Collect diagnostics about the repository in a zip file

Setup & Creating Projects · 0 optionsOpen →

◐ Basic Snapshotting

⑂ Branching & Merging

☁ Sharing and Updating

◎ Inspection & Comparison

⌕ Debugging

✎ Patching & Rewriting

▦ Workspaces & Large Projects

⚙ Administration

git archive

Export a version as a zip or tar file

Export the files of a commit as a zip or tar archive

Administration · 3 optionsOpen →

git bundle

Move a repository as a single file

Pack commits and branches into a single file

Administration · 2 optionsOpen →

git fsck

Check the repository and find lost commits

Verify the repository and find unreachable objects

Administration · 2 optionsOpen →

git fast-export

Dump the history as a text stream

Export history as a fast-import text stream

Administration · 1 optionsOpen →

git fast-import

Build a repository from a fast-import stream

Administration · 0 optionsOpen →

git gc

Clean up and optimize the repository

Administration · 0 optionsOpen →

git maintenance

Run or schedule background repository maintenance

Administration · 0 optionsOpen →

git repack

Pack loose objects into packfiles

Administration · 0 optionsOpen →

git pack-refs

Pack references into a single file

Administration · 0 optionsOpen →

git prune

Delete unreachable objects

Administration · 0 optionsOpen →

git count-objects

Count objects and show how much disk space they use

Administration · 0 optionsOpen →

git refs

Low-level access to the reference storage

Administration · 0 optionsOpen →

git instaweb

Browse the repository in a web browser

Administration · 0 optionsOpen →

⧉ External Tools