v4 started as a simple bug-fix for this one-part series, but since it's not going to make 2.18.0 at this point I thought I'd do some more work on it. Comments on patches below: Ævar Arnfjörð Bjarmason (9): checkout tests: index should be clean after dwim checkout Tests that would have revealed the bug in v3. checkout.h: wrap the arguments to unique_tracking_name() checkout.[ch]: move struct declaration into *.h Boring moving code around. checkout.[ch]: introduce an *_INIT macro Make checkout.h have a TRACKING_NAME_DATA_INIT for its struct. checkout.[ch]: change "unique" member to "num_matches" checkout: pass the "num_matches" up to callers builtin/checkout.c: use "ret" variable for return Refactoring with no changes yet to make subsequent changes smaller. checkout: add advice for ambiguous "checkout <branch>" Even if checkout.defaultRemote is off we now print advice telling the user why their "git checkout branch" didn't work. checkout & worktree: introduce checkout.defaultRemote It's now called checkout.defaultRemote not checkout.implicitRemote on Junio's suggestion. On reflection that's better. Improved tests for git-worktree (similar to the dwim checkout tests improvements earlier), and the the documentation for git-checkout & git-worktree. I'm omitting the tbdiff because most of it's because of the new patches in this series. Better just to read them. Documentation/config.txt | 26 +++++++++++++++ Documentation/git-checkout.txt | 9 ++++++ Documentation/git-worktree.txt | 9 ++++++ advice.c | 2 ++ advice.h | 1 + builtin/checkout.c | 44 ++++++++++++++++++++------ builtin/worktree.c | 4 +-- checkout.c | 37 +++++++++++++++------- checkout.h | 16 +++++++++- t/t2024-checkout-dwim.sh | 58 +++++++++++++++++++++++++++++++++- t/t2025-worktree-add.sh | 21 ++++++++++++ 11 files changed, 203 insertions(+), 24 deletions(-) -- 2.17.0.290.gded63e768a