Think you’re good with Git? Most developers use commands like add
, commit
, and push
every day, but Git has many more helpful commands.
In this post, I’ll show you 7 Git commands that many experienced developers use to work faster, fix problems, recover lost work, and keep their projects organized.
Before we get started, don’t forget to subscribe to my newsletter!
Get the latest tips, tools, and resources to level up your web development skills delivered straight to your inbox. Subscribe here!
Now, let’s jump right into it!
1. git blame
You can use the `git blame` command to check who last changed each line of a file and when.
It’s helpful for figuring out who made specific changes or understanding a file’s history.
git blame <filename>
2. git cherry-pick
The `git cherry-pick` command allows you to copy changes from one commit and apply them to another branch.
It’s helpful when you only want to bring over specific changes without merging the entire branch.
git cherry-pick <commit-hash>
3. git merge — — squash
The `git merge — — squash` command combines all the changes from one branch into a single commit on another branch.
Instead of creating a merge commit, it squashes all the changes into one, making your commit history cleaner and simpler.
git merge -- squash <branch-to-merge>
4. git rebase -i
The `git rebase -i` (interactive rebase) command allows you to change your commit history. It lets you reorder, edit, and remove commits.
It gives you more control over your commit log, making it easier to clean up and organize your history.
git rebase -i <base-branch>
5. git reflog
You can use the `git reflog` command to view a record of all recent changes to your branches and other references.
It can be very useful if you need to recover lost commits or understand recent changes in your project.
git reflog
6. git stash
The `git stash` command allows you to temporarily save changes that are not yet ready to be committed.
This is handy when you need to switch branches or pull updates but want to save your current work without committing it.
git stash
7. git worktree
The `git worktree` command allows you to create multiple working directories, each associated with a different branch or commit.
This is useful for working on different tasks simultaneously without having to constantly switch branches.
# Add a new worktree git worktree add <path> <branch> # List existing worktrees git worktree list # Remove a worktree git worktree remove <path> # Remove worktrees that no longer exist git worktree prune
That’s all for today!
If you’re new to web development, check out Learnify — my curated platform with beginner-friendly tutorials to help you learn web development step-by-step with examples and simple explanations.
If you enjoy my work and want to support what I do:
👉 Become a Patreon supporter
👉 Or buy me a coffeeEvery small gesture keeps me going! 💛
Follow me on X (Twitter) to get daily web development tips & insights.
Enjoyed reading? You may also find these articles helpful.
16 Free Resources to Learn Web Development in 2025
10 MERN Stack Projects You Should Build