why some git commits are older than their parent?

I was looking at apache-drill commit 3efc2eca and I realized that it is older than its parent commit 8614bae.

I have had a couple of other similar observations.
How can I explain them?

  • how does github 52 week participation work?
  • Git: send-email without commit
  • Project commits too many files
  • Hey git, what happened to the last commits?
  • save old git repository versions
  • Why did the changes of a git commit disappear after other 2 commits (where I did not change the affected file)?
  • git: timezone and timestamp format
  • How to include newline characters in git tag messages
  • git checkout to restore files from a prior branch: pathspec did not match any file(s) known to git
  • Unable to discard the local changes in Git
  • git-svn merge 2 svn branches
  • How to git rebase -i for a range of commits?
  • 2 Solutions collect form web for “why some git commits are older than their parent?”

    Commit history in git is rewritable. There are many ways that that could have happened. The most likely way is that the commit was rebased after it was created.

    You can change git history with an interactive rebase, e.g.:

    git rebase --interactive|-i HEAD~(number of commits)
    

    Here is the scenario:

    $ git commit -m 'Commit 1'
    $ git commit -m 'Commit 2'
    $ git rebase -i HEAD~2
      // changing only 'Commit 1'
      edit bae2ea4 Commit 1
      pick 0e25612 Commit 2
    $ git add .
    $ git commit --amend
    $ git rebase --continue
    

    After these ‘Commit 2’ will be older than its parent ‘Commit 1’

    You should remember that you are not advised to rewrite history after your changes were published (pushed).

    Git Baby is a git and github fan, let's start git clone.