AI-Powered Holi: How Technology is Transforming the Festival of Colors
AI-Powered Holi: How Technology is Transforming the Festival of Colors
March 01, 2026
If you want to become a great developer, you need to master Git.
But Git can be confusing. With so many commands and options, it’s hard to know which ones actually matter.
In this article, I’ll walk you through the Top 20 Git Commands every developer should know.
These are the exact commands I’ve used over the past 11 years as a programmer. If you get comfortable with just these, you’ll be ready for almost anything Git throws your way.
git initTurns a regular folder into a Git repository by creating a hidden .git directory.
git init
Use this when starting a new project from scratch.
git configSets your user name and email identity for Git commits.
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
git cloneClones an existing repository from a remote source.
git clone https://github.com/user/repo.git
git remoteManages your remote repositories.
git remote -v
git remote add origin https://github.com/user/repo.git
git statusDisplays the current state of the working directory and staging area.
git status
git addStages files for commit.
git add filename
git add .
git commitRecords changes to the repository.
git commit -m "Your commit message"
git commit --amend # To modify the last commit
git pushUploads local changes to the remote repository.
git push origin main
git pullFetches and merges changes from a remote branch.
git pull origin main
git fetchDownloads changes from the remote repository but doesn’t apply them.
git fetch origin
git branchLists, creates, or deletes branches.
git branch
git branch new-feature
git checkoutSwitches branches or restores files.
git checkout new-feature
git checkout -b another-feature
git checkout -- file.txt
Alternative: Use
git switch branch-namefor switching branches.
git mergeMerges one branch into the current branch.
git merge new-feature
git rebaseReapplies commits on top of another base tip.
git rebase main
⚠️ Be cautious with rebasing public/shared branches.
git logShows commit history.
git log
git log --oneline
git log --graph --oneline
git diffShows the differences between changes.
git diff
git diff main new-feature
git stashTemporarily stores changes without committing.
git stash
git stash list
git stash apply
git stash pop
git resetMoves the current branch tip and optionally modifies the index and working directory.
git reset --soft HEAD~1
git reset --mixed HEAD~1
git reset --hard HEAD~1
git revertCreates a new commit that undoes the changes from a previous commit.
git revert <commit-hash>
git cherry-pickApplies the changes introduced by a specific commit to the current branch.
git cherry-pick <commit-hash>
That’s it! These 20 commands are the bread and butter of using Git effectively.
Once you’re confident using them, you’ll be able to:
Bookmark this post or save it in your notes — it’s your Git cheat sheet.
If you found this useful, share it with your dev circle and follow me for more dev tips!
Happy coding! 🚀