Living With Git - How to do things in Git

How to deal with changing git commits date?

First of all, there are two dates in a commit. Author date and commit date. As descriptive they are, let make it clear. Author date - the date of sb creating the change - “authoring” Commit date - the date of sb commiting - “pushing” the change on to the repo

How to change dates?

Changing committer date

The author date - using either

git commit --amend

It prompts probably VIM where you can easily change the date of the commit (author date).

OR

git commit --amend --no-edit --date="January 1 1970 00:00 +0000"

--no-edit works as to keep the whole commit intact only change the date and do not prompt VIM

The trick is with the committer date.

GIT_COMMITTER_DATE is the key here. Using the command

GIT_COMMITTER_DATE="January 1 1970 00:00 +0000" git commit --amend --no-edit

How to squash commit?

git reset --soft HEAD~2

After this you can commit the changes.