I wanted to "follow-up" with another question about this matter: Checkout old commit and make it a new commit
But they say "Don't Do That!" so it seems I must ask a new question. (Even though it is the same question where the answer I think is best for me didn't work as expected...
If I have commits
A-B-C-D-E-F
(imagine these are all SHA's).
I want to make the entire repository exactly as C
and then commit that to create 'G'
which is exactly like C
. So that when I am done the log is A-B-C-D-E-F-G even though C & G are identical.
One answer indicated cherry-pick, which seemed perfect, except it made me resolve every conflict between C
and F
. I looked at the documentation and I tried --force
anyway, and then the recommendation for --patch
. --patch
was closest but it wasn't absolute. So is there a way to make cherry-pick just choose the C
version of the conflict?
The other closest answer would be to checkout C
, but I couldn't find the magic word that would keep it on the same branch. The recent training I completed said use the "magic dash dash" at the end to tell git
you want this on the current branch, but no matter what I do it creates a "(no branch)" branch.
As I am sure you can tell, I am pretty new to git (and command line in general) but I tried to figure it out on my own. If you could use the verbose versions of what you recommend then it sticks in my head better and would be greatly appreciated. (-a
= --all
or -a = --annotate
or -a = --albuquerque?
)
It seems so simple, and exactly what you might want to do with git -- go back a previous commit without losing the intermediary commits in case you change your mind.