@@ -933,7 +933,14 @@ def checkout(self, paths=None, force=False, fprogress=lambda *args: None, **kwar
933933 If one of files or directories do not exist in the index
934934 ( as opposed to the original git command who ignores them ).
935935 Raise GitCommandError if error lines could not be parsed - this truly is
936- an exceptional state"""
936+ an exceptional state
937+
938+ .. note:: The checkout is limited to checking out the files in the
939+ index. Files which are not in the index anymore and exist in
940+ the working tree will not be deleted. This behaviour is fundamentally
941+ different to *head.checkout*, i.e. if you want git-checkout like behaviour,
942+ use head.checkout instead of index.checkout.
943+ """
937944 args = ["--index" ]
938945 if force :
939946 args .append ("--force" )
@@ -1055,7 +1062,7 @@ def reset(self, commit='HEAD', working_tree=False, paths=None, head=False, **kwa
10551062 If False, the working tree will not be touched
10561063 Please note that changes to the working copy will be discarded without
10571064 warning !
1058-
1065+
10591066 :param head:
10601067 If True, the head will be set to the given commit. This is False by default,
10611068 but if True, this method behaves like HEAD.reset.
@@ -1067,6 +1074,11 @@ def reset(self, commit='HEAD', working_tree=False, paths=None, head=False, **kwa
10671074
10681075 :param kwargs:
10691076 Additional keyword arguments passed to git-reset
1077+
1078+ .. note:: IndexFile.reset, as opposed to HEAD.reset, will not delete anyfiles
1079+ in order to maintain a consistent working tree. Instead, it will just
1080+ checkout the files according to their state in the index.
1081+ If you want git-reset like behaviour, use *HEAD.reset* instead.
10701082
10711083 :return: self """
10721084 # what we actually want to do is to merge the tree into our existing
@@ -1098,7 +1110,7 @@ def reset(self, commit='HEAD', working_tree=False, paths=None, head=False, **kwa
10981110 # END handle working tree
10991111
11001112 if head :
1101- self .repo .head .commit = self .repo .commit (commit )
1113+ self .repo .head .set_commit ( self .repo .commit (commit ), logmsg = "%s: Updating HEAD" % commit )
11021114 # END handle head change
11031115
11041116 return self
0 commit comments