I would like to rebase a branch on the master branch but in such a way that all commits show up in chronological order in the git log. Is this possible without git rebase
If you want to keep the original dates, you are stuck with rebasing according to your dates.
However, if you want to create a pull request and get the commits sorted correctly in a tool that sorts by author date (TFS and GitHub both do), you might want to change the dates instead.
Windows:
git rebase --force-rebase --exec "ping localhost -n 3" --exec "git commit --amend --date=now" master
Linux:
git rebase --force-rebase --exec "sleep 2" --exec "git commit --amend --date=now" master
Note that doing git rebase --ignore-date master
does not work, because the date only has second resolution and different commits will get the same date and be sorted in an unspecified order. If you use --exec
and --ignore-date
together, the --ignore-date
parameter will be ignored. Because it is incompatible with interactive mode, which --exec
uses.