On Thu, 19 Apr 2007, Jeff Garzik wrote: > > What is the easiest way to completely undo a pull, reverting the branch to the > HEAD present before the pull?
You can either do git reset --hard ORIG_HEAD (git will set ORIG_HEAD before things like pulls or resets, so you can always go back), or, if you have reflogs enabled (and if you set up your repository with a modern git version it probably will be enabled by default), you can just do git reset --hard @{1} where "@{1}" just means "HEAD ref state one change ago" (the same way you can say "@{2.hours.ago}" to mean HEAD state two hours ago). In either case, double-check that that is indeed the version you want to revert to with git log ORIG_HEAD or git log @{1} first, since obviously if you give "git reset --hard" the wrong version, it will reset to the wrong state. Although especially with reflogs, your previous state will always be logged, so you can always re-do what you undid by (again) doing "git reset --hard @{1}" to get back the previous state ;) ALSO! Make sure that you don't have any dirty state in your working tree that you don't want to lose! "git reset --hard" will do what it implies: it will reset your tree. Very much including throwing away all your dirty state (and that you can't get back by going to a previous commit, since it was never committed!) Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/