Master Git — It's Easier Than You Think!
Every time I interview someone, I’m surprised when a developer doesn’t know Git.
You don’t need to be an expert, but every developer should know the basics.
git init
Initialize a new repository.
git clone https://github.com/user/repo.git
Clone a remote repository.
git status
Check the current status of files.
git add .
Add all changes to the staging area.
git commit -m "Message"
Commit changes with a message.
git log
View commit history.
git diff
See differences between the working directory and the index.
git checkout branch-name
Switch to another branch.
git branch
List all local branches.
git branch branch-name
Create a new branch.
git merge branch-name
Merge a branch into the current one.
git pull
Fetch and merge changes from the remote repository.
git push
Push changes to the remote repository.
git stash
Stash current changes without committing.
git reset --hard
Reset the working directory to the last commit (caution!).
git rebase branch-name
Move current branch changes on top of another branch.
Example: git rebase main
brings your branch up to date with main
.
git rebase -i HEAD~3
Interactive rebase of the last 3 commits, for example to squash.
# In interactive rebase
pick a1b2c3 First commit
squash d4e5f6 Second commit (will be combined)
Squash: combine multiple commits into one.
git revert <hash>
Create a new commit that reverts the specified one (without erasing history).
Want to remember it better? Host a mini-meetup:
📌 Even in a team of just 3 — this helps everyone grow.
Want to practice Git hands-on?
Here’s a fantastic interactive tool:
branch
, merge
, and rebase
work.📌 Complete the first 3–4 levels — Git will finally make sense.
If you’re still confused by add
, commit
, and pull
,
today is the perfect day to master them.
git status
.Good luck! And may merge conflicts
only appear on holidays 😄