this happens to every developer time-to-time. You start coding a new feature and forget to branch first locally.
So if that happens is there a way I can say hey, transf
Then there is no harm in switching to a new branch after files have been modified. Edited, non-committed files are always viewed in the context of whatever branch is checked out:
git checkout -b mytopicbranch
Following the description: here:
git branch mytopicbranch
It now has all the commits that you wanted to make.
git reset abc5b0de1 --hard
Assuming abc5b0de1
is the fingerprint of the commit right before you made the accidental commits.
Now you can switch back to mytopicbranch
as needed.