Report

Help us improve this tool

Git Commands Memo

An interactive Git cheat sheet with search, categorizations, and real-time custom command parameter inputs.

O M T

Essential Git Commands and Workflow Guide

Git is a distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Whether you are working individually or coordinating in a large team, Git helps you track changes, revert back to previous states, branch off to develop isolated features, and synchronize with cloud hosts like GitHub, GitLab, or Bitbucket.

Remembering all the command flags and parameters can be challenging. This interactive Git cheat sheet allows you to customize parameter values (like branch names, commit messages, username/email configuration, and file paths) on the left side, and copy the customized commands instantly on the right.

Core Git Command Categories

1. Setup and Initialization

Before tracking changes, configure your identity so that commits are correctly attributed to you. Use git config globally or per-repository. To start a repository, use git init in an existing folder, or clone a remote repo with git clone.

2. Basic Snapshotting (Staging & Committing)

The typical local workflow involves making edits in your working directory, staging them with git add, and recording them to history with git commit. The staging area acts as a buffer where you prepare what goes into your next commit.

3. Branching and Merging

Branches allow you to work on bug fixes or new features without touching the stable master or main code. Create a branch using git branch [name], switch to it with git checkout [name], and merge it back using git merge [name] once testing is complete.

4. Sharing and Synchronizing

To back up your code and collaborate with others, link your local repository to a remote server. Use git push to upload your commits, and git pull to download and merge updates from your team.

For other developer-oriented utilities, feel free to check out our Chmod Calculator for setting file permissions, or convert command line configurations with our Docker Run to Docker Compose Converter.

Frequently Asked Questions

What is the difference between git fetch and git pull?

git fetch downloads the latest history and references from the remote repository but does not modify your local working directory files. git pull is a combination of git fetch followed immediately by git merge, updating your active branch with the remote changes.

How can I undo my last commit without losing local changes?

You can run git reset --soft HEAD~1. This removes the last commit record, but leaves all modified files staged in your index so you can edit and recommit them.

What does the git stash command do?

git stash temporarily shelves (saves) changes you have made in your working directory so you can work on something else, and resets your working directory to match the HEAD commit. You can restore your stashed changes later using git stash pop.