From 54bc7ea0741677bb199ef06c89e9aa06ba1de5a6 Mon Sep 17 00:00:00 2001 From: Ben Lynn Date: Tue, 5 Aug 2008 20:36:17 -0700 Subject: [PATCH] Elaborate on checkout safety. --- grandmaster.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/grandmaster.txt b/grandmaster.txt index b15ca87..a4818dc 100644 --- a/grandmaster.txt +++ b/grandmaster.txt @@ -218,10 +218,12 @@ Recent versions of Git make it difficult for the user to accidentally destroy da Nonetheless, what if you truly want to destroy data? We'll show how to override the safeguards for common commands. Only use them if you know what you are doing. -*Checkout*: If you have uncommitted changes, checkout will fail. To destroy your changes, and checkout a given commit anyway, use the force flag: +*Checkout*: If you have uncommitted changes, a plain checkout fails. To destroy your changes, and checkout a given commit anyway, use the force flag: $ git checkout -f COMMIT +On the other hand, if you specify particular paths for checkout, then there are no safety checks. The supplied paths are quietly overwritten. Take care if you use checkout in this manner. + *Reset*: Reset also fails in the presence of uncommitted changes. To force it through, run: $ git reset --hard [COMMIT] -- 2.11.4.GIT