nzn
nzn

Reputation: 1081

git reset --soft HEAD^ for initial commit

Could someone please tell me what would be an equivalent of git reset --soft HEAD^ for an initial commit? I'm trying to find a really safe one-liner without any deletions :)

To further clarify: I want all the files I tediously added to be in the index and ready for committing after the command is run.

Upvotes: 8

Views: 5745

Answers (1)

Fake Code Monkey Rashid
Fake Code Monkey Rashid

Reputation: 14547

As you found, for the initial commit using git reset --soft HEAD^ doesn't work.

What does work is using git update-ref -d HEAD.

But provided that there is only one branch and one commit, it's can be easier to just delete the .git directory and start over. Of course, you should only do that if you know what you are doing.

Upvotes: 11

Related Questions