@@ -933,7 +933,14 @@ def checkout(self, paths=None, force=False, fprogress=lambda *args: None, **kwar
933
933
If one of files or directories do not exist in the index
934
934
( as opposed to the original git command who ignores them ).
935
935
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
+ """
937
944
args = ["--index" ]
938
945
if force :
939
946
args .append ("--force" )
@@ -1055,7 +1062,7 @@ def reset(self, commit='HEAD', working_tree=False, paths=None, head=False, **kwa
1055
1062
If False, the working tree will not be touched
1056
1063
Please note that changes to the working copy will be discarded without
1057
1064
warning !
1058
-
1065
+
1059
1066
:param head:
1060
1067
If True, the head will be set to the given commit. This is False by default,
1061
1068
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
1067
1074
1068
1075
:param kwargs:
1069
1076
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.
1070
1082
1071
1083
:return: self """
1072
1084
# 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
1098
1110
# END handle working tree
1099
1111
1100
1112
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 )
1102
1114
# END handle head change
1103
1115
1104
1116
return self
0 commit comments