I git-commit everything I do every hour. This is nice but I end up with way too many commits.
I'd like to be able to purge this so that instead of :
1 hour ago
2 hours ago
.
23 hours ago
24 hours ago
I just have something like:
1 hour ago
2 hours ago
1 day ago
7 days ago
etc.
Currently each hour I do:
git-add .
git-commit -a
How can I remove certain commits? I don't want to undo any changes. I just don't care to have quite so many points to revert to. I'd like to have a lot of commits for the past few hours but then only a few after that (the past day, week, month, etc. or other major points that I keep on purpose).
Many Small CommitsThey are easier to understand, easier to test, and easier to review. The complexity of understanding, testing and reviewing a change often increases faster than its size: ten 200-line changes each doing one thing are often far easier to understand than one 2,000 line change doing ten things.
Revert a commit with ease if something goes wrong. Big commits are harder to revert since you may not want to revert all of the changes but only a subset. Small commits are easier to understand when reviewing a pull request.
As a general rule, when merging a pull request from a feature branch with a messy commit history, you should squash your commits. There are exceptions, but in most cases, squashing results in a cleaner Git history that's easier for the team to read.
Have a look at the git rebase -i
command. This lets you 'squash' commits into larger ones, which seems like what you want to do.
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