I was working ahead because I need free time for the next few days and I have already committed the changes to my local repository and pushed a fork that I have as a backup.
Now as for the origin, I want to push commits A and B dated from say next Monday (I don't want them to have the original commit date).
The same happens with commits C and D, which I want to push on Tuesday, dated Tuesday.
Is it possible to do this using git without doing a
git reset ... and re-committing on Monday and Tuesday respectively?
I understand that there are two parts to this, one would be to change the commit date and the other would be to push only one group of commits on Monday and another on Tuesday.
I can't do a
git reset and re-commit using
git commit --date as these commits modify the same files and it wouldn't be consistent, I'll take that into account next time.
(I don't want them to have the original commit date)
It seems to me that there is a misconception here. When you "pusheas" you are not "pushing to the repository", you are simply (maybe partially) syncing the remote repository with the local one. GIT (unlike CVS or Subversion) is distributed, which means that there is actually only one repository, which is mirrored (maybe partially) in different places. So you can't just push a commit with different data (in this case the date). The repository is the same, the commit is the same.
What you can do is change the commit date (local), and then push it:
git filter-branch --env-filter \ 'if [ "$GIT_COMMIT" == "6489982f81797b71534357fa5a442a2604c61eff" ] then export GIT_AUTHOR_DATE="2016-03-20T05:57:12-03:00" export GIT_COMMITTER_DATE="2016-03-20T05:57:12-03:00" fi'
(copied from here: https://stackoverflow.com/a/454750/277304 ) (change commit hash and date-time)
Regarding pushing just a few commits, the syntax is:
git push <remoto> <SHA del commit>:<branch>