20 Essential Git Commands Explained Simply | Memorabit

20 Essential Git Commands Explained Simply

A developer's workflow often involves navigating a project's history, a task made manageable with version control. When starting a new project, git init creates the necessary repository structure. Should a change need temporary removal from the current work, git stash sets uncommitted changes aside without committing them. These actions, among others, form the bedrock of efficient code management.

Every term in the following list can be added to Memorabit, which sends it as a reminder at an unexpected moment. The full list follows.

Term Meaning
git init Creates an empty Git repository or reinitializes an existing one.
git clone Clones a repository into a new directory.
git add Adds file contents to the index.
git status Shows the working tree status.
git diff Shows changes between commits, or between a commit and the working tree.
git commit Records changes to the repository.
git restore Restores working tree files.
git reset Sets HEAD or the index to a known state.
git rm Removes files from the working tree and index.
git mv Moves or renames a file, directory, or symlink.
git branch Lists, creates, or deletes branches.
git switch Switches branches.
git merge Joins two or more development histories together.
git log Shows commit logs.
git stash Stashes changes in a dirty working directory away.
git tag Creates, lists, deletes, or verifies tags.
git fetch Downloads objects and refs from another repository.
git pull Fetches from and integrates with another repository or local branch.
git push Updates remote refs and associated objects.
git rebase Reapplies commits on top of another base tip.