When I work on a feature branch with Git, I like to do smaller commits in the branch. This allows me to rollback certain changes and to easily switch to another computer.
One thing that I don’t like about this approach is that when I do my final
git rebase -i
to squash all my commits into one, the timestamp of the final commit is the same as the first commit in the chain.
When I’ve been working for 3 days on something, I’d rather the timestamp be the same as if I had done one big commit in my branch, at the end, rather than one commit at the start and then nothing.
To fix this, I’ve found that I simply need to do:
git commit --amend --reset-author
and leave the information as is. This will update the last rebased commit to the current date and time.