I'm a newbie to git, and got a little ahead of myself in creating/deleting branches and wanted to figure out the right process. Basically, I started on a new branch (branch_a
) and then made a few changes. I then decided to test a third party package knowing it may not work as I wanted. At this point, I have a few changes in branch A which I didn't stage or commit. I went on to checkout a new branch (branch_b
). I played around with this "test branch" and then decided to delete it. First I did a check-out of the original branch:
git checkout branch_a
Then, I deleted the branch thinking all the changes I made would get deleted too:
git branch -d branch_b
So the branch gets deleted but when I go back to branch_a
to continue work from where I left off, I see the changes I made in branch_b
are still there. Since I didn't commit anything before, I can't figure out how to separate the changes pre-branch_b
and post-branch-b
. Is this still possible?
And in terms of "the process", is there a better way to create and delete test branches? E.g. should I have used git reset --hard
?