I am on a particular Git branch b. I added some new features and pushed some code to it.…
- User
I am on a particular Git branch
b. I added some new features and pushed some code to it. Now, however I would like to shift new development to a branch,b1, created fromb.In my VS Code, I am currently on
band have already added new features but haven't pushed them to remote. I am thinking I need a safe way to port these changes tob1(created fromb) and then roll backbto a specific commit, so that it feels like all new dev has happened onb1.Does this make sense? Am i doing what's right? If yes, then let me know how I should proceed.
Assistant
Yes, your plan makes sense — you're essentially wanting to:
- Preserve your new work (currently on
b, uncommitted or un-pushed). - Move that work to a new branch
b1(branched fromb). - Reset
bto a clean state (likely the last pushed commit). - Continue development on
b1, as if it were the new feature branch.
This is a common and safe workflow. Here's how to do it step-by-step in VS Code (or terminal):
✅ Step-by-step (safe and reversible)
1. Stash or commit your current changes
If your changes are uncommitted:
- Preserve your new work (currently on