I have a branch in my repository with a new commit (say 'Commit A') regarding a new change. And I didn't push the commit yet to the remote repository.
Now, one fix is missing from this commit and I would like to:
git reset HEAD~1
(come back to the previous commit A-1, putting back the last committed changes in the working directory)- change the files for the missing fix
git add .
git commit
(say 'Commit B')git push
My question is mainly regarding the reset commit (A).
- will it stay around as detached commit? Or will it still be in my branch?
- will this push the 'Commit A' to the remote repository in any way?
- will it mess my history? Or
git push
will just sync the commit into the branch, ignoring the detached ones? (that is 'Commit A')
And finally
- what if instead I had 'Commit A' already pushed and try to do the same sequence of operations?