Michael Michael - 1 year ago 83
Git Question

Inverse of git reset --soft

git reset --soft
will keep your current changes, but move HEAD to another commit.

I am looking for an inverse of this operation, so that HEAD would remain stationary but state of all files would be set to the same as in commit CommitX.

I found a workaround:

git diff --no-prefix HEAD..CommitX | patch -p0

But I am wondering if there is a simple git command to do that.

Answer Source

You can use git read-tree command to read particular tree into index. With -m -u options it will also update working directory.

git read-tree -m -u CommitX
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download