My question is similar to Git - unchange line endings in already committed file, though the accepted answer seems to be mostly musings, and not helpful in my situation.
I have several fairly large commits. Between my editor and my git configuration at the time, I committed many line ending changes
For example, I changed on line in a file, but my commit changes line endings for the thousands of other lines in the file.
I have not pushed the commits. How to I remove the line ending changes before I push?
I tried
git rebase [last_good_commit]
but it just said
current branch *** is up to date.
Simply force a rebase for the commits you haven’t pushed yet, and tell it to apply whitespace fixes to the patches:
git rebase --whitespace=fix -f <last_good_commit>
Rebase internally works via applying patches, and conveniently git-apply
supports fixing the whitespace with the --whitespace
option.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With