3 ms·
For what it's worth, you can still do it with those commands, though I understand part of the point is that you don't necessarily remember all of the options fo
by lcnPylGDnU4H9OF 1y ago
For what it's worth, you can still do it with those commands, though I understand part of the point is that you don't necessarily remember all of the options for them. But in this case, it should be simple:
git add .
git commit --amend -m "initial commit"
git push -f origin HEAD
I don't know when `--amend` was added. I used to do a squash rebase but this is much nicer.
- monkpit 1y agogit commit --amend --no-edit
- Terr_ 1y ago> I used to do a squash rebase This probably wouldn't apply to the "initial commit" problem, but I almost always use fixup instead of amend, ex: git add foo.code git commit --fixup {commit_with} git rebase -i --autosquash {main_or_whatever} Unlike amend, you can target an older commit rather than just the very-most-recent (great if you're separating the rename/refactor from the rewrite) and you can delay the second step of actually changing history until you're sure stuff is in a good state. This is particularly useful for the review process: All the changes during the review process can be "fixup" commits, allowing reviewers to easily see what did (or didn't) change since their last interaction. At the same time, all the fiddly fixes and back-and-forth stuff won't be in the final history, only a smaller number of "real" commits that future maintainers would care about.
- tczMUFlmoNk 1y ago--amend was added in 2006 :-) https://github.com/git/git/commit/b4019f045646b1770a80394da876b8a7c6b8ca7b https://github.com/git/git/commit/b4019f045646b1770a80394da8...