7

Possible Duplicate:
git delete and recreate branch

To be honest I'm not sure ORIG_HEAD can be called a branch, yet it appears in my visual editor as one.

I have made a "git reset --hard HEAD~1" and then made some changes, finally committing them. How to get right of that ORIG_HEAD branch?

Community
  • 1
  • 1
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
  • Possible duplicate of [git delete and recreate branch](https://stackoverflow.com/questions/11844581/git-delete-and-recreate-branch) – Cœur Jul 14 '18 at 14:21

1 Answers1

14

See "HEAD and ORIG_HEAD in Git":

ORIG_HEAD is previous state of HEAD, set by commands that have possibly dangerous behavior, to be easy to revert them.
It is less useful now that Git has reflog: HEAD@{1} is roughly equivalent to ORIG_HEAD

In your case, you did a git reset, so Git left a "reminder" of where you were before said reset.
You can ignore it.

You can also get rid of it with a simple

rm -f $GIT_DIR/ORIG_HEAD
# or
rm -f .git/ORIG_HEAD

That is what the example/git-reset.sh script does for instance.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Sure, VonC. I know that I can ignore it. But I don't want to have it dangling around. I'd like to get rid of it if possible. – devoured elysium Sep 14 '12 at 11:04
  • @devouredelysium I have edited the answer to include a way to get rid of `ORIG_HEAD` – VonC Sep 14 '12 at 11:19
  • @powder366 not sure. It is possible the next command which doesn't need to set `ORIG_HEAD` could remove it. – VonC Jan 21 '13 at 15:50