Reputation: 21
When trying to fix merge issues of binary files I use the git checkout --ours path/to/file.txt but it keeps returning Updated 0 paths from Index. Any ideas on what is going wrong?
Upvotes: 2
Views: 6220
Reputation: 1329972
As commented, that should means nothing was updated because it was not needed to be updated.
Since Git 2.23 (Q3 2019), the right command would be
git restore --ours -- path/to/file.txt
If you are still using git checkout, use Git 2.38 (Q3 2022), because "git checkout
"(man) miscounted the paths it updated, which has been corrected.
See commit 611c778, commit 11d14de, commit ed602c3 (14 Jul 2022) by Matheus Tavares (matheustavares
).
(Merged by Junio C Hamano -- gitster
-- in commit acdb1e1, 01 Aug 2022)
checkout
: fix two bugs on the final count of updated entriesSigned-off-by: Matheus Tavares
At the end of
git checkout
(man)<pathspec>
, we get a message informing how many entries were updated in the working tree.
However, this number can be inaccurate for two reasons:
- Delayed entries currently get counted twice.
- Failed entries are included in the count.
The first problem happens because the counter is first incremented before inserting the entry in the delayed checkout queue, and once again when
finish_delayed_checkout()
callscheckout_entry()
.And the second happens because the counter is incremented too early in
checkout_entry()
, before the entry was in fact checked out.Fix that by moving the count increment further down in the call stack and removing the duplicate increment on delayed entries.
Note that we have to keep a per-entry reference for the counter (both on parallel checkout and delayed checkout) because not all entries are always accumulated at the same counter.
See
checkout_worktree()
, atbuiltin/checkout.c
for an example.
Upvotes: 1