Skip to main content
Cheatsheet50 commands9 groupsClick to copy

50 Git commands Cheatsheet

The Git commands you will use every day, grouped by what they do. Copy any command with one click, and see where it moves your files.

⭐ MOST USED: START WITH THESEPick a command to see what it does
git status

Shows which files you changed, which are staged and which Git is not tracking yet. It never changes anything.

ReadsWorking folder and Staging area
USE IT WHEN

Before every add and commit, so you know exactly what you are about to save.

💡 TIP

Run it often. It is the safest command in Git.

1 of 10

Understanding Git: Adding the Files to Git​

Git moves your changes through four places. Most commands just move files from one place to the next. Click a place to see the commands that work there.

Tip: git add moves files to staging, git commit saves them to your local repo, git push sends them to GitHub.

All Git commands​

Pick any command on the left to see what it does, where it moves your files and when to use it. The copy icon copies it straight away. Advanced commands sit at the end of the list.

50 of 50 commands
Basic commands
git init

Creates a hidden .git folder, so Git starts tracking this folder as a new repository.

CreatesLocal repository
USE IT WHEN

Once, at the start of a brand new project.

💡 TIP

Cloned projects already have a .git folder. Do not run it again there.

1 of 50
KEY
Working folderStaging areaLocal repoRemote
Can delete work<orange> Your own value

<file> Replace the part in orange with your own value. ⚠ Careful Can delete work. Read before running.

Watch the video

Conclusion​

Bookmark this page and come back whenever you need a command. In the next lesson you will create your first GitHub repository.

UP NEXTCreate GitHub Repo (GUI)
Share this page

MAINTAINED BY

Sanjay Viswanathan

@sanjay-kv

Founder of recodehive and Technical program manager, Prev Google ML Facilitator & Ex- GitHub CE who delivered 100+ talks on ML and open source and developer advocacy.

Was this helpful?

Your vote helps us improve our docs.

Improve this page

All our docs are open source. Found a typo, want to add detail or have a better explanation? Anyone can contribute.

Comments

Powered by GitHub Discussions