How do you move commit to staging area in git?

If you want to move a commit to an intermediate region - it is to expose it and move all the changes that were in it to the intermediate region (effectively placing the branch in the state that would be before commit) - how do you do it? Or is that something you cannot do?

The closest I know how to do is copy all the files that have been changed in commit to another location, reset the commit branch to commit, which you are trying to move to the intermediate area, move all the copied files back to the repository and then add them to the intermediate region. It works, but it is not a good solution. What I would like to do is simply undo the commit and move it to the setting area. It can be done? And if so, how?

+62
git commit staging
Aug 27 2018-11-11T00:
source share
1 answer
git reset --soft HEAD^ 

This will reset your HEAD ^ index (previous commit), but leave your changes in the staging area.

There are some handy diagrams in git-reset docs

+119
Aug 27 '11 at 10:52
source share



All Articles