Skip to main content
The 2024 Developer Survey results are live! See the results

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • 41
    git reset $(git commit-tree HEAD^{tree} -m "commit message") would make it easier.
    – ryenus
    Commented Feb 4, 2013 at 7:19
  • 7
    ^ THIS! - should be an answer. Not entirely sure if it was the author's intention, but was mine (needed a pristine repo with a single commit, and that gets the job done).
    – chesterbr
    Commented Jan 23, 2014 at 14:04
  • @ryenus, your solution did exactly what I was looking for. If you add your comment as an answer, I'll accept it.
    – tldr
    Commented May 4, 2014 at 0:38
  • 2
    The reason I didn't suggest the subshell-variant myself, is that it won't work on cmd.exe in Windows.
    – kusma
    Commented May 5, 2014 at 16:36
  • 1
    In Windows prompts, you might have to quote the last parameter: echo "message" | git commit-tree "HEAD^{tree}"
    – Bernard
    Commented Feb 18, 2016 at 23:48