Member-only story
Git Cheat Sheet with 40+ commands & concepts
4 min readNov 13, 2022
Press enter or click to view image in full size![]()
Tired of memorizing git commands? Here is a cheat sheet with 40+ commands to simplify your life.
1. Initialize a local repository
git init <directory>The <directory> is optional. If you don't specify it, the current directory will be used.
2. Clone a remote repository
git clone <url>3. Add a file to the staging area
git add <file>To add all files in the current directory, use . in place of <file>.
git add .4. Commit changes
git commit -m "<message>"If you want to add all changes made to tracked files & commit
git commit -a -m "<message>"
# or
git commit -am "<message>"5. Remove a file from the staging area
git reset <file>6. Move or rename a file
git mv <current path> <new path>7. Remove a file from the repository
git rm <file>