Moving a Commit to a New Branch without Losing Progress! 💻🔧

Sometimes we realize after committing that the changes belong on a different branch. Instead of manually copying files, here's a clean, simple way to "move" your last commit to a new branch! 👇

1️⃣ Reset the Last Commit (Keep Changes Staged)

git reset --soft HEAD~1

This removes your last commit but keeps the changes in your staging area.

2️⃣ Stash the Changes

git stash

Temporarily save the changes so you can apply them later.

3️⃣ Create or Switch to a New Branch

 git checkout -b new-branch-name

4️⃣ Reapply the Stashed Changes

git stash pop

Your changes are back and ready to be committed on the new branch.

💡 It's a great trick for keeping your branches clean and making sure commits are organized. No lost work, and no confusion! 🎉

#DevTips #GitTips #SoftwareDevelopment #CleanCode #VersionControl #FrontendEngineering #BackendEngineering