| ▲ | 1718627440 a day ago | |
> Correct me I'm I'm wrong but I think were talking about using `git reset HEAD^` for splitting a commit. I wasn't. I wanted to do the same as in the FAQ entry we are talking about, so I wanted to reset it to an older commit representing the same change (i.e. before an amend that we are now reverting). This is likely in a rebase, but we can always rebase later and only do the splitting now. > With `--mixed`, it will also move the index back one step, so the index is empty (relative to HEAD) Yes and this is the default (without any flag). > That's what meant when I said "`git reset` by itself doesn't split a commit", because you need to do something like this: That's what the `--soft` is for, then `git reset` does not touch the index. > Just that additional steps are needed. The only "additional" step required is specifying a commit message, which, as I said earlier, to me is a sensible default. What I suggested applied on this case would be:
If you want to do it with rebase:
More idiomatic, due to using the global list of todo commits:
You can drop the rebase, when it is really the commit in HEAD you want to split.Actually what you can also do, but this doesn't use reset, is this:
This will even do what you wanted and just reuse the same commit message without asking.Honestly, what I do most of the time to split commits (when there isn't an older version I want to split it to) is to just amend and then unselect the changes I don't want with the cursor. | ||