From: W. Trevor King Date: Thu, 15 Mar 2012 00:47:34 +0000 (-0400) Subject: Add notes on rewinding bare repositories in Git. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bc3c3a493ef6e0d424ad0c2b32dac58abbabf4dc;p=blog.git Add notes on rewinding bare repositories in Git. --- diff --git a/posts/Git/notes.org b/posts/Git/notes.org index e89f7d1..702b158 100644 --- a/posts/Git/notes.org +++ b/posts/Git/notes.org @@ -546,6 +546,21 @@ above and try or add however many =^= you need to get back to the last good commit. +*** Rewinding bare repositories + +If you're trying to [[http://stackoverflow.com/questions/4624881/how-can-i-uncommit-the-last-commit-in-a-git-bare-repository][roll back a few commits in a bare repository]] +you'll need to use: + + : $ git update-ref HEAD HEAD^ + +If you're in another branch, use: + + : $ git update-ref refs/heads/branch-name branch-name^ + +And if you're going back further, use the sha1: + + : $ git update-ref refs/heads/branch-name a12d48e2 + ** Git submodules, nesting/tracking sub-repositories. This is a nice way of grouping associated projects. The submodules