Yes you can achieve this - branch away from the current branch and create a new branch to preserve the commit, checkout back to the original branch, and then rollback the commit in the original branch.
So from your current branch, (lets call it current
), create and checkout a new branch separate
git checkout -b separate
This will create a new branch separate
which will have the new commit. Now go back to the original branch
git checkout current
On this branch, you can now rollback the last commit
git reset --hard HEAD~1
If you later want to access that older commit, you have to do a git checkout separate
and the commit should be available in that branch.