P
P
petrouv2011-02-17 18:25:44
git
petrouv, 2011-02-17 18:25:44

What happens if you make a new commit after git reset --soft

I had three commits. Two of them were made by mistake and I wanted to revert the commits, but not the changes in the working directory.
I did git reset --soft hash_of_commit_1.
Then I made new commits, as I needed.
Git log now shows everything as it should, i.e. commit_1 and further new commits.
However, knowing the hashes of the two erroneous commits that I wanted to revert, I can see them using git show.
Question: where in history are these two erroneous commits now and did I do everything right?

PS And for some reason, git log --graph does not work for me. Writes: "fatal: unrecognized argument: --graph"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sannis, 2011-02-17
@Sannis

They may not be in the history (depending on whether you pushed somewhere), but they remained in the repository. You can do a git gc to clear the repository of unlinked commits.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question