Skip to content

Commit b5a0bd6

Browse files
pcloudsgitster
authored andcommitted
read-tree.txt: clarify --reset and worktree changes
The description of --reset stays true to the first implementation in 438195c (git-read-tree: add "--reset" flag, 2005-06-09). That is, --reset discards unmerged entries. Or at least true to the commit message because I can't be sure about read-tree's behavior regarding local changes. But in fcc387d (read-tree -m -u: do not overwrite or remove untracked working tree files., 2006-05-17), it is clear that "-m -u" tries to keep local changes, while --reset is singled out and will keep overwriting worktree files. It's not stated in the commit message, but it's obvious from the patch. I went this far back not because I had a lot of free time, but because I did not trust my reading of unpack-trees.c code. So far I think the related changes in history agree with my understanding of the current code, that "--reset" loses local changes. This behavior is not mentioned in git-read-tree.txt, even though old-timers probably can just guess it based on the "reset" name. Update git-read-tree.txt about this. Side note. There's another change regarding --reset that is not obviously about local changes, b018ff6 (unpack-trees: fix "read-tree -u --reset A B" with conflicted index, 2012-12-29). But I'm pretty sure this is about the first function of --reset, to discard unmerged entries correctly. PS. The patch changes one more line than necessary because the first line uses spaces instead of tab. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent aeb582a commit b5a0bd6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Documentation/git-read-tree.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,9 @@ OPTIONS
3838
started.
3939

4040
--reset::
41-
Same as -m, except that unmerged entries are discarded
42-
instead of failing.
41+
Same as -m, except that unmerged entries are discarded instead
42+
of failing. When used with `-u`, updates leading to loss of
43+
working tree changes will not abort the operation.
4344

4445
-u::
4546
After a successful merge, update the files in the work

0 commit comments

Comments
 (0)