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.

14
  • 8
    The git revision syntax (HEAD^{tree}) syntax is explained here in case anyone else was wondering: jk.gs/gitrevisions.html Commented Jun 23, 2014 at 23:45
  • 2
    Does this reset both the local and remote repository, or just one of them?
    – aleclarson
    Commented Oct 28, 2014 at 7:41
  • 7
    @aleclarson, this only reset the current branch in the local repository, use git push -f for propagation.
    – ryenus
    Commented Oct 28, 2014 at 12:20
  • 2
    I found this answer while looking for a way to start a new project from a project template repository that didn't involve git clone. If you add --hard to git reset and switch HEAD with FETCH_HEAD in the git commit-tree you can create an initial commit after fetching the template repo. I've edited the answer with a section at the end demonstrating this.
    – user23987
    Commented Feb 7, 2015 at 19:57
  • 6
    You could get rid of that "Caveat" but just using ${1?Please enter a message} Commented Oct 13, 2017 at 20:57