You get some advanced git commands
git stash — Save Work Without Committing Ever got stuck when you need to switch branches but don’t want to commit half-done work?
git stash

It saves your changes in a "stash" and cleans your working directory.

Later, you can reapply the stashed changes with:

git stash pop

Tip: You can even stash with a message:

git stash save "WIP: fixing login bug"

2.git cherry-pick — Apply Specific Commits
Want to pick a single commit from one branch and apply it to another?

git cherry-pick 

Great for moving small bug fixes without merging entire branches.

3.git rebase— Rewrite History Cleanly
Instead of a messy merge, you can reapply commits on top of another branch:

git checkout feature-branch
git rebase main

Makes history linear and clean.

Interactive rebasing (git rebase -i) even lets you squash commits together!

git rebase -i HEAD~5

You can pick, squash, or reword commits easily during interactive rebase.

4.git reflog — Find Lost Commits
Deleted a branch or a commit accidentally? Don’t worry!

git reflog

It shows a log of everything you've done, including commits that aren't reachable anymore.

You can recover with:

git checkout 

5.git reset — Undo Changes
Soft reset (keep changes but unstage):

git reset --soft HEAD~1

Mixed reset (unstage and keep working directory):

git reset --mixed HEAD~1

Hard reset (dangerous! discard changes):

git reset --hard HEAD~1

Use hard resets carefully — once changes are gone, they're usually gone for good unless you use reflog.

6.git bisect — Find Bugs Faster
Git can automatically help you find the commit where a bug was introduced!

Start bisecting:

git bisect start

Mark the current version as bad:

git bisect bad

Mark an older working version as good:

git bisect good 

Git will checkout commits one by one — you test and tell Git whether it's "good" or "bad" until it narrows down the exact problematic commit.

7.git tag — Mark Important Points
Use tags for releases, versions, or milestones.

Create a lightweight tag:

git tag v1.0

Create an annotated tag:

git tag -a v1.0 -m "Release version 1.0"

Push tags:

git push origin v1.0

Or push all tags:

git push origin --tags

8.git clean — Remove Untracked Files
Want to remove junk (files not tracked by Git)?

Preview what would be deleted:

git clean -n

Actually delete them:

git clean -f

Be very careful with git clean — it’s powerful!

9.git remote prune — Clean Up Deleted Branches
Sometimes remote branches get deleted, but you still see them locally. Clean them up with:

git remote prune origin

10.git shortlog — Summarize Contributions
Want to generate a quick summary of who contributed?

git shortlog -sn