On Git, say I mess up my commits, and I want to make the version 3 commits ago as the new version. If I do git checkout xxxx
, it creates a new branch and it seems like I can only merge it? Could I make this the new "master version"?
I want:
A-B-C-D-E
to become
A-B-C-D-E-F
where F has exactly the same content as C
If I use git revert xxxx
instead, it seems like it definitely will have conflicts and I need to manually resolve it.
What I really want is just make the old commit at some point the new commit, regardless of what's in my working directory or the latest commit.
How would I go about doing this?
git checkout <commit-hash> .
don't miss the final dot in the command – Ibrahim Tayseergit rm -r .
is fairly necessary prior to that command, otherwise if there is any file that is present in the newer version but not in the older version is still kept around. – huggie