I created a
in branch A
If you want to create a new branch, there's no need to stash. You can create a new branch starting from the latest good commit.
branch A, get the hash of the latest good commit, by using
git log. Then run:
git checkout <branchA_hash> -b branchB
This will create a new branch called
branchB, updated at that commit you've chosen.
In any moment you can then come back to your messy branch A by just checking it out again.