Please note: I understand my question is very similar to this one -- however there IS a slight difference! Please ready this question in its entirety!
New to git, I made a bunch of changes on my project's develop
branch, whereas it seems I should have cut a feature branch off of develop
first and made my changes there. I have already added (git add .
) and committed (git commit -m "blah"
) my changes but I have not pushed them yet.
I'm hoping there is a way to:
- Create a new branch off of my local
develop
and move my changes over to it - Reset my local
develop
so that its as if I never made changes todevelop
in the first place
From the question I referenced above, it seems that the correct solution is something like this:
git checkout -b newbranch
git merge develop
git checkout develop
git reset --hard HEAD~X # Go back X commits
git checkout newbranch
Here's how my question is different than the one I mentioned:
The problem is: this is a very active project and MANY (30+) commits by MANY other developers have transpired since I started making my local changes.
So I'm note sure what the real value of HEAD~X
needs to be!
Ideally, I'd like to just say: "Hey git
, whatever is the latest on the remote develop
, yeah, set my local develop
to that commit and completely blow out/erase any of my committed changes to it."
Is this possible to do?