Use future date while making git commits
You can use commit --date argument:
git commit -m "message" --date "Tue Apr 28 23:00:00 2015 +0300"
UPD: there is also pretty cool script for shifting old commits date (you need Perl to run it): https://raw.githubusercontent.com/gitbits/git-shift/master/git-shift
perl git-shift +5h 2e6fd0a9dc98403c4fca638e411b3451cbc66a89
UPD2: You can create custom alias in order to shift all new commits automatically. In order to do that, put the following line into your ~/.bashrc file
alias future-commit='git commit --date "$(date -v +4H)"'
or
alias future-commit='git commit --date "$(date -d +4hours)"'
reload terminal and now you will be able to commit with +4 hours shift:
future-commit -m "future commit"
You can make commits in any date, time using
GIT_AUTHOR_DATE='your date' GIT_COMMITTER_DATE='your date' git commit -m 'message'
The format for 'your date'
is like Fri May 01 19:32:10 2015 -0400
.
Note that author and committer are different entities in git terminology, and so both the timestamps need to be set (unlike the options provided in other comments and answers).
In general, the author_date is the one that is picked up by github/in git log etc, and the committer_date is visible when you view all the commit information, like in gitk
. If altering the author_date alone works, use the --date
option as the other answer points.