From bc3c3a493ef6e0d424ad0c2b32dac58abbabf4dc Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 14 Mar 2012 20:47:34 -0400 Subject: [PATCH] Add notes on rewinding bare repositories in Git. --- posts/Git/notes.org | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 -- 2.26.2