git hook post-checkout does not work as expected 
Hi, 
The best procedure to reproduce the bug is following step 4 of basic scenarios, versioning:
https://katacoda.com/dvc/courses/basics/versioning

It is expected that git checkout automatically triggers dvc checkout so the file.txt is restored to proper version which was committed, but it does not and `cat file.txt` gives `test 3` after every checkout. `dvc install` has successfully installed the hooks, I checked, but I do not know if the tutorial is wrong or the hook is not working properly.  
diff --git a/dvc/scm/git/__init__.py b/dvc/scm/git/__init__.py
index ad1fcb2da..7d7f17648 100644
--- a/dvc/scm/git/__init__.py
+++ b/dvc/scm/git/__init__.py
@@ -275,9 +275,10 @@ class Git(Base):
             [
                 # checking out some reference and not specific file.
                 '[ "$3" = "1" ]',
-                # check that we are on some branch/tag and not in detached HEAD
-                # state, so we don't accidentally break a rebase.
-                '[ "$(git rev-parse --abbrev-ref HEAD)" != "HEAD" ]',
+                # make sure we are not in the middle of a rebase/merge, so we
+                # don't accidentally break it with an unsuccessful checkout.
+                # Note that git hooks are always running in repo root.
+                "[ ! -d .git/rebase-merge ]",
             ],
             "checkout",
         )
['dvc/scm/git/__init__.py']