Tom Hale Tom Hale - 1 year ago 102
Git Question

git reset --soft without moving branch reference

I want to move

, and only do that.

This means I want to keep untouched:

  • Index

  • Working tree

  • Commit to which the current branch reference points

git reset --soft
does the first two, but not the last.

Is there a way to do this without creating a new branch?

Answer Source

You can achieve this by doing:

echo $(git rev-parse $commit) > $(git rev-parse --git-dir)/HEAD

But it is discouraged.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download