Git is one of those tools you'll use almost every day, whether you're building applications, collaborating with a team, or managing deployment pipelines.
While there are hundreds of Git commands available, only a handful become part of your daily workflow.
This guide covers 30 practical Git commands that every developer, DevOps engineer, and software engineer should know.
Instead of memorizing them, focus on understanding when to use each one.
1.
Initialize a Repository Creates a new Git repository in your current project folder so version control can begin.
2.
Clone an Existing Repository Downloads an existing Git repository from GitHub or another Git provider to your local machine.
3.
Check Repository Status Shows modified, staged, and untracked files so you always know the current state of your project.
4.
Stage Specific Files Adds selected files to the staging area before creating a commit.
To stage everything:
5.
Commit Your Changes Saves the staged changes as a new snapshot in the repository with a meaningful commit message.
6.
Upload Changes Pushes your local commits to the remote repository.
7.
Download Latest Changes Fetches updates from the remote repository and merges them into your current branch.
8.
View Commit History Displays the project's commit history along with author information and timestamps.
9.
List All Branches Shows every local branch available in your repository.
10.
Create a New Branch Creates a new branch and immediately switches to it.
11.
Switch Between Branches Moves your working directory to another branch.
12.
Merge Another Branch Combines changes from another branch into your current branch.
13.
View Remote Repositories Displays the configured remote repositories and their URLs.
14.
Add a Remote Repository Connects your local repository to a remote Git server.
15.
Remove a Remote Deletes a configured remote repository.
16.
Compare Changes Shows the differences between your working directory, staged files, and commits.
17.
Fetch Without Merging Downloads the latest commits from the remote repository without changing your current branch.
18.
Save Work Temporarily Temporarily stores uncommitted changes so you can switch tasks without committing unfinished work.
Restore them later:
19.
Unstage a File Removes a file from the staging area while keeping your local modifications.
20.
Delete a Tracked File Deletes a file and stages that deletion for the next commit.
21.
Configure Git Identity Sets the default identity used for all your commits.
22.
Create a Version Tag Creates a tag that marks an important release or milestone.
Push tags using:
23.
Delete a Branch Removes a branch that has already been merged.
24.
Rebase a Branch Moves your branch on top of another branch to maintain a cleaner project history.
25.
Abort a Merge Conflict Cancels an ongoing merge and restores the repository to its previous state.
26.
Apply a Single Commit Copies a specific commit from another branch without merging the entire branch.
27.
Remove Stale Remote Branches Deletes local references to remote branches that no longer exist.
28.
Clean Untracked Files Removes untracked files and folders from your working directory.
Use this carefully because deleted files cannot be recovered through Git.
29.
Initialize Git Submodules Downloads and initializes all project submodules.
This is commonly required after cloning repositories that depend on external projects.
30.
Clone with Submodules Clones the repository and automatically downloads all associated submodules in one step.
Final Thoughts Learning Git isn't about memorizing every available command.
It's about becoming comfortable with the commands you'll use repeatedly throughout development.
If you can confidently work with branching, committing, merging, fetching, rebasing, and resolving conflicts, you'll be prepared for most real world Git workflows.
Which Git command do you use the most?
Share it in the comments, and if you think I missed one that deserves a place in this list, I'd love to hear your suggestions.
Happy coding! 🚀