{"thread":{"id":"65608","subject":"[PATCH] git-jump: pick a mode automatically when invoked without arguments","startedAt":"2026-05-08T09:07:40Z","lastAt":"2026-05-26T21:33:25Z","messageCount":15,"participants":["Greg Hurrell via GitGitGadget","Jeff King","Greg Hurrell","Erik Cervin Edin","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"542901","messageId":"pull.2108.git.1778231254871.gitgitgadget@gmail.com","threadId":"65608","inReplyTo":null,"subject":"[PATCH] git-jump: pick a mode automatically when invoked without arguments","fromName":"Greg Hurrell via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-08T09:07:34Z","receivedAt":"2026-05-08T09:07:40Z","isPatch":true,"body":"From: Greg Hurrell <greg.hurrell@datadoghq.com>\n\nWhen `git jump` is invoked with no positional arguments (and no\narguments after `--stdout`) it currently prints usage and exits with\nstatus 1.\n\nBut there are two situations where we can usefully infer the most\nvaluable and likely mode that a user would want to use, and select it\nautomatically when they run `git jump` without arguments:\n\n1. When there are unmerged paths in the index, the user likely\n   wants `git jump merge`.\n\n2. When the working tree has unstaged changes, the user likely\n   wants `git jump diff`.\n\nDetect these two cases and dispatch to the corresponding mode\nautomatically, falling back to the existing usage-and-exit behavior\nwhen neither holds.\n\nSigned-off-by: Greg Hurrell <greg.hurrell@datadoghq.com>\n---\n    git-jump: pick a mode automatically when invoked without arguments\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2108%2Fwincent%2Fauto-jump-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2108/wincent/auto-jump-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/2108\n\n contrib/git-jump/README   |  4 ++++\n contrib/git-jump/git-jump | 16 +++++++++++++---\n 2 files changed, 17 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/git-jump/README b/contrib/git-jump/README\nindex 3211841305..420b20b6a2 100644\n--- a/contrib/git-jump/README\n+++ b/contrib/git-jump/README\n@@ -55,6 +55,10 @@ To use it, just drop git-jump in your PATH, and then invoke it like\n this:\n \n --------------------------------------------------\n+# pick a mode automatically: \"merge\" if there are unmerged paths,\n+# \"diff\" if the worktree has unstaged changes, otherwise show usage\n+git jump\n+\n # jump to changes not yet staged for commit\n git jump diff\n \ndiff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\nindex 8d1d5d79a6..ac0ad2f037 100755\n--- a/contrib/git-jump/git-jump\n+++ b/contrib/git-jump/git-jump\n@@ -2,7 +2,7 @@\n \n usage() {\n \tcat <<\\EOF\n-usage: git jump [--stdout] <mode> [<args>]\n+usage: git jump [--stdout] [<mode>] [<args>]\n \n Jump to interesting elements in an editor.\n The <mode> parameter is one of:\n@@ -99,8 +99,18 @@ while test $# -gt 0; do\n \tshift\n done\n if test $# -lt 1; then\n-\tusage >&2\n-\texit 1\n+\tif test \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" != \"true\"; then\n+\t\tusage >&2\n+\t\texit 1\n+\tfi\n+\tif test -n \"$(git ls-files -u)\"; then\n+\t\tset -- merge\n+\telif ! git diff --quiet; then\n+\t\tset -- diff\n+\telse\n+\t\tusage >&2\n+\t\texit 1\n+\tfi\n fi\n mode=$1; shift\n type \"mode_$mode\" >/dev/null 2>&1 || { usage >&2; exit 1; }\n\nbase-commit: 94f057755b7941b321fd11fec1b2e3ca5313a4e0\n-- \ngitgitgadget\n"},{"id":"542921","messageId":"20260508141314.GB709299@coredump.intra.peff.net","threadId":"65608","inReplyTo":"pull.2108.git.1778231254871.gitgitgadget@gmail.com","subject":"Re: [PATCH] git-jump: pick a mode automatically when invoked without arguments","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2026-05-08T14:13:14Z","receivedAt":"2026-05-08T14:13:15Z","isPatch":true,"body":"On Fri, May 08, 2026 at 09:07:34AM +0000, Greg Hurrell via GitGitGadget wrote:\n\n> From: Greg Hurrell <greg.hurrell@datadoghq.com>\n> \n> When `git jump` is invoked with no positional arguments (and no\n> arguments after `--stdout`) it currently prints usage and exits with\n> status 1.\n> \n> But there are two situations where we can usefully infer the most\n> valuable and likely mode that a user would want to use, and select it\n> automatically when they run `git jump` without arguments:\n> \n> 1. When there are unmerged paths in the index, the user likely\n>    wants `git jump merge`.\n> \n> 2. When the working tree has unstaged changes, the user likely\n>    wants `git jump diff`.\n> \n> Detect these two cases and dispatch to the corresponding mode\n> automatically, falling back to the existing usage-and-exit behavior\n> when neither holds.\n\nOK, I guess this saves a little bit of typing. I never really thought\nabout it because I long ago aliased the various invocations in my shell\n(\"git jump diff\" in particular is so useful that it is just \"d\" in my\nshell).\n\nI'd be a little worried that it is more confusing to somebody\napproaching the command for the first time and just runs \"git jump\" to\nnot see usage or other guidance. But that might be overly paranoid.\n\nWould having \"git jump auto\" work for you? I.e., are you primarily\ntrying to avoid the mental effort of selecting the command, or the\nfinger effort of typing it?\n\n>  if test $# -lt 1; then\n> -\tusage >&2\n> -\texit 1\n> +\tif test \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" != \"true\"; then\n> +\t\tusage >&2\n> +\t\texit 1\n> +\tfi\n> +\tif test -n \"$(git ls-files -u)\"; then\n> +\t\tset -- merge\n> +\telif ! git diff --quiet; then\n> +\t\tset -- diff\n> +\telse\n> +\t\tusage >&2\n> +\t\texit 1\n> +\tfi\n\nThe implementation looks reasonable. In theory we could save a diff\ninvocation by trying diff mode and reporting whether it found anything.\nBut the --quiet invocation is not too expensive, and avoiding it is\nprobably not worth the gymnastics required.\n\n-Peff\n"},{"id":"542924","messageId":"c5e0a1fa-f228-41dd-b547-07b0ad6c0964@app.fastmail.com","threadId":"65608","inReplyTo":"20260508141314.GB709299@coredump.intra.peff.net","subject":"Re: [PATCH] git-jump: pick a mode automatically when invoked without arguments","fromName":"Greg Hurrell","fromEmail":"greg@hurrell.net","sentAt":"2026-05-08T14:30:36Z","receivedAt":"2026-05-08T14:30:58Z","isPatch":true,"body":"On Fri, May 8, 2026, at 4:13 PM, Jeff King wrote:\n> On Fri, May 08, 2026 at 09:07:34AM +0000, Greg Hurrell via GitGitGadget wrote:\n> \n> I'd be a little worried that it is more confusing to somebody\n> approaching the command for the first time and just runs \"git jump\" to\n> not see usage or other guidance. But that might be overly paranoid.\n\nHopefully, they at least read the README before installing it from contrib/\n(although Homebrew recently starting installing it for folks automatically,\nso may not remain true for much longer on macOS...)\n \n> Would having \"git jump auto\" work for you? I.e., are you primarily\n> trying to avoid the mental effort of selecting the command, or the\n> finger effort of typing it?\n\nIt's mostly the finger effort of typing it because I generally know exactly\nwhich mode I want; eg.\n\n- I'm in the middle of a rebase, and hit a conflict; 100% of the time,\n  I want to explore the conflicts, so I want `git jump` to do `git jump\n  merge`.\n\n- I have unstaged changes, and I want to make some tweaks before committing;\n  so I want `git jump` to do `git jump diff`.\n\n- Otherwise, I'm wanting to search for something (ie. `git jump grep`),\n  so by definition I'm going to be doing some extra typing anyway (ie.\n  `git jump grep <pattern>`).\n\nThis is muscle memory for me at this point, because I've had a `git jump`\nalias for this in my dotfiles[^1] for a couple of years. Homebrew\ninstalling `git-jump` by default a few months ago[^2] broke this, because\naliases can't shadow builtin commands.\n\n[^1]: https://github.com/wincent/wincent/commit/99183f86fe35\n[^2]: https://github.com/Homebrew/homebrew-core/commit/e9fc066240f2\n\nBest wishes,\nGreg\n"},{"id":"542929","messageId":"20260508175240.GA737125@coredump.intra.peff.net","threadId":"65608","inReplyTo":"c5e0a1fa-f228-41dd-b547-07b0ad6c0964@app.fastmail.com","subject":"Re: [PATCH] git-jump: pick a mode automatically when invoked without arguments","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2026-05-08T17:52:40Z","receivedAt":"2026-05-08T17:52:41Z","isPatch":true,"body":"On Fri, May 08, 2026 at 04:30:36PM +0200, Greg Hurrell wrote:\n\n> On Fri, May 8, 2026, at 4:13 PM, Jeff King wrote:\n> > On Fri, May 08, 2026 at 09:07:34AM +0000, Greg Hurrell via GitGitGadget wrote:\n> > \n> > I'd be a little worried that it is more confusing to somebody\n> > approaching the command for the first time and just runs \"git jump\" to\n> > not see usage or other guidance. But that might be overly paranoid.\n> \n> Hopefully, they at least read the README before installing it from contrib/\n> (although Homebrew recently starting installing it for folks automatically,\n> so may not remain true for much longer on macOS...)\n\nYeah, I'd hope so. And even if it might be more discoverable, I'm not\nsure that is more important than being convenient for experienced users.\n\nI guess a config option would be possible, but probably not worth it for\nsomething as trivial as git-jump.\n\n> It's mostly the finger effort of typing it because I generally know exactly\n> which mode I want; eg.\n\nOK, that makes sense.\n\n> This is muscle memory for me at this point, because I've had a `git jump`\n> alias for this in my dotfiles[^1] for a couple of years. Homebrew\n> installing `git-jump` by default a few months ago[^2] broke this, because\n> aliases can't shadow builtin commands.\n\nAh, yeah, that is frustrating. We try to avoid aliases overrides to\nprevent confusion, but for an add-on tool like git-jump I think it is\noverly cautious. It might be reasonable to limit that protection only to\ncommands in Git's exec-path, but I haven't thought hard about it. And I\nthink it should be considered separately from this patch anyway.\n\nSo yeah, your patch looks good to me. Thanks.\n\n-Peff\n"},{"id":"543330","messageId":"agXb1SXKnA69L9ak@mbp","threadId":"65608","inReplyTo":"20260508175240.GA737125@coredump.intra.peff.net","subject":"Re: [PATCH] git-jump: pick a mode automatically when invoked without arguments","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2026-05-14T15:40:34Z","receivedAt":"2026-05-14T15:40:39Z","isPatch":true,"body":"On 26/05/08 04:30PM, Greg Hurrell wrote:\n> Hopefully, they at least read the README before installing it from contrib/\n> (although Homebrew recently starting installing it for folks automatically,\n> so may not remain true for much longer on macOS...)\n\nOh! I didn't know that but looking closer on my homebrew installed Git,\nlooks like you're right.\n\nI would've assumed that if users had jumped through the hoops of\ninstalling git-jump from contrib/ it stands to reason they would have\nsome sense of what it does. But if this is landing as a part of regular\nbrew install git, I'd wager there's a few unsuspecting people running\ngit-jump that don't know what it does.\n\n> Would having \"git jump auto\" work for you?\n\nImo, this sounds ideal -- there's something odd about `git jump` picking\nthe subcommand heuristically. At least when I invoke git-jump I always\ndo so with a specific intent of _where_ I want to jump. Then again, I\nnever do a jump merge or a jump ws.\n\n> Homebrew installing `git-jump` by default a few months ago[^2] broke\n> this, because aliases can't shadow builtin commands.\n\nBut it looks like this doesn't work in this case. Even if you have\ngit-jump installed stand-alone (mine is in ~/bin/git-jump, in PATH,\nbefore /opt/homebrew/bin.)\n\nFWIW I alias jump to j, jump diff to jd and jump grep to jg. E.g.\n\n    git jd # git jump diff\n\nOn 26/05/08 09:07AM, Greg Hurrell via GitGitGadget wrote:\n> -usage: git jump [--stdout] <mode> [<args>]\n> +usage: git jump [--stdout] [<mode>] [<args>]\n\nThe usage message makes <mode> optional but doesn't explain what\nhappens when you omit it. Seems worth documenting the auto-detect behavior\nthere too.\n\n> But there are two situations where we can usefully infer the most\n> valuable and likely mode that a user would want to use, and select it\n> automatically when they run `git jump` without arguments:\n>\n> 1. When there are unmerged paths in the index, the user likely\n>    wants `git jump merge`.\n>\n> 2. When the working tree has unstaged changes, the user likely\n>    wants `git jump diff`.\n\nI can think of a third situation -- when there are staged changes flagged by\ngit diff --cached --check.\n\nIf we're going to teach git-jump how to be more clever about where to jump,\ndoes it also make sense to bake `git jump ws` into this?\n\nAlso, if this is going to grow into a proper auto-detect heuristic, it\nmight be cleaner as a first-class mode rather than logic spliced into the\nargument parser. Something like:\n\n    mode_auto() {\n        if test -n \"$(git ls-files -u)\"; then\n            mode_merge \"$@\"\n        elif ! git diff --quiet; then\n            mode_diff \"$@\"\n        elif ! git diff --cached --check >/dev/null 2>&1; then\n            mode_ws --cached \"$@\"\n        else\n            return 0\n        fi\n    }\n\nThat way `git jump auto` works explicitly, bare `git jump` defaults\nto it (just `set -- auto` when $# -lt 1), and the usage text can\ndocument the heuristic. It also keeps the detection and dispatch in\none place in case someone wants to tweak the priority later.\n\nAll in all, I think an auto jumping mode could be genuinely useful.\n"},{"id":"543609","messageId":"8f4b75d8-f875-434a-8fc5-06a708cbc53f@app.fastmail.com","threadId":"65608","inReplyTo":"agXb1SXKnA69L9ak@mbp","subject":"Re: [PATCH] git-jump: pick a mode automatically when invoked without arguments","fromName":"Greg Hurrell","fromEmail":"greg@hurrell.net","sentAt":"2026-05-19T09:03:44Z","receivedAt":"2026-05-19T09:04:06Z","isPatch":true,"body":"On Thu, May 14, 2026, at 5:40 PM, Erik Cervin Edin wrote:\n> On 26/05/08 09:07AM, Greg Hurrell via GitGitGadget wrote:\n> > -usage: git jump [--stdout] <mode> [<args>]\n> > +usage: git jump [--stdout] [<mode>] [<args>]\n> \n> The usage message makes <mode> optional but doesn't explain what\n> happens when you omit it. Seems worth documenting the auto-detect behavior\n> there too.\n> \n> If we're going to teach git-jump how to be more clever about where to jump,\n> does it also make sense to bake `git jump ws` into this?\n> \n> Also, if this is going to grow into a proper auto-detect heuristic, it\n> might be cleaner as a first-class mode rather than logic spliced into the\n> argument parser. Something like:\n> \n>     mode_auto() {\n>         if test -n \"$(git ls-files -u)\"; then\n>             mode_merge \"$@\"\n>         elif ! git diff --quiet; then\n>             mode_diff \"$@\"\n>         elif ! git diff --cached --check >/dev/null 2>&1; then\n>             mode_ws --cached \"$@\"\n>         else\n>             return 0\n>         fi\n>     }\n> \n> That way `git jump auto` works explicitly, bare `git jump` defaults\n> to it (just `set -- auto` when $# -lt 1), and the usage text can\n> document the heuristic. It also keeps the detection and dispatch in\n> one place in case someone wants to tweak the priority later.\n\nAll of those suggestions sound reasonable to me. Jeff, do you agree?\nIf so, I can update the patch.\n\nBest wishes,\nGreg\n"},{"id":"543708","messageId":"20260519212234.GA2278669@coredump.intra.peff.net","threadId":"65608","inReplyTo":"8f4b75d8-f875-434a-8fc5-06a708cbc53f@app.fastmail.com","subject":"Re: [PATCH] git-jump: pick a mode automatically when invoked without arguments","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2026-05-19T21:22:34Z","receivedAt":"2026-05-19T21:22:36Z","isPatch":true,"body":"On Tue, May 19, 2026 at 11:03:44AM +0200, Greg Hurrell wrote:\n\n> On Thu, May 14, 2026, at 5:40 PM, Erik Cervin Edin wrote:\n> > On 26/05/08 09:07AM, Greg Hurrell via GitGitGadget wrote:\n> > > -usage: git jump [--stdout] <mode> [<args>]\n> > > +usage: git jump [--stdout] [<mode>] [<args>]\n> > \n> > The usage message makes <mode> optional but doesn't explain what\n> > happens when you omit it. Seems worth documenting the auto-detect behavior\n> > there too.\n> > \n> > If we're going to teach git-jump how to be more clever about where to jump,\n> > does it also make sense to bake `git jump ws` into this?\n> > \n> > Also, if this is going to grow into a proper auto-detect heuristic, it\n> > might be cleaner as a first-class mode rather than logic spliced into the\n> > argument parser. Something like:\n> > \n> >     mode_auto() {\n> >         if test -n \"$(git ls-files -u)\"; then\n> >             mode_merge \"$@\"\n> >         elif ! git diff --quiet; then\n> >             mode_diff \"$@\"\n> >         elif ! git diff --cached --check >/dev/null 2>&1; then\n> >             mode_ws --cached \"$@\"\n> >         else\n> >             return 0\n> >         fi\n> >     }\n> > \n> > That way `git jump auto` works explicitly, bare `git jump` defaults\n> > to it (just `set -- auto` when $# -lt 1), and the usage text can\n> > document the heuristic. It also keeps the detection and dispatch in\n> > one place in case someone wants to tweak the priority later.\n> \n> All of those suggestions sound reasonable to me. Jeff, do you agree?\n> If so, I can update the patch.\n\nYeah, I agree that having an explicit \"auto\" mode (and then just\ndefaulting to it) makes perfect sense.\n\nI don't really have an opinion on adding \"ws\" in here. Despite being the\nperson who added the whitespace mode in the first place, I can't\nremember ever using it in the last 10 years. ;) But the cost is fairly\nlow to support it, so we might as well.\n\n-Peff\n"},{"id":"543740","messageId":"pull.2108.v2.git.1779280307112.gitgitgadget@gmail.com","threadId":"65608","inReplyTo":"pull.2108.git.1778231254871.gitgitgadget@gmail.com","subject":"[PATCH v2] git-jump: pick a mode automatically when invoked without arguments","fromName":"Greg Hurrell via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-20T12:31:46Z","receivedAt":"2026-05-20T12:31:53Z","isPatch":true,"body":"From: Greg Hurrell <greg.hurrell@datadoghq.com>\n\nWhen `git jump` is invoked with no positional arguments (and no\narguments after `--stdout`) it currently prints usage and exits with\nstatus 1.\n\nBut there are several situations where we can usefully infer the most\nvaluable and likely mode that a user would want to use, and select it\nautomatically:\n\n1. When there are unmerged paths in the index, the user likely\n   wants `git jump merge`.\n\n2. When the working tree has unstaged changes, the user likely\n   wants `git jump diff`.\n\n3. In the presence of conflict markers or whitespace errors (as reported\n   by `git diff --check`), the user likely wants `git jump ws`.\n\nIn this commit we teach `git jump` a new \"auto\" mode which detects these\ncases and dispatches to the corresponding mode automatically. The user\ncan either explicitly spell out `git jump auto`, or just leave it at\n`git jump` (because \"auto\" is the default).\n\nIf none of the interesting cases listed above applies, then auto mode\nfalls back to the existing usage-and-exit behavior.\n\nSigned-off-by: Greg Hurrell <greg.hurrell@datadoghq.com>\n---\n    git-jump: pick a mode automatically when invoked without arguments\n    \n    Changes since v0:\n    \n     * Added explicit \"auto\" keyword/mode.\n     * Updated additional detail to usage info and README.\n     * (Bonus) Added ws usage example to README.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2108%2Fwincent%2Fauto-jump-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2108/wincent/auto-jump-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/2108\n\nRange-diff vs v1:\n\n 1:  87fa66d233 ! 1:  5fbc8480ef git-jump: pick a mode automatically when invoked without arguments\n     @@ Commit message\n          arguments after `--stdout`) it currently prints usage and exits with\n          status 1.\n      \n     -    But there are two situations where we can usefully infer the most\n     +    But there are several situations where we can usefully infer the most\n          valuable and likely mode that a user would want to use, and select it\n     -    automatically when they run `git jump` without arguments:\n     +    automatically:\n      \n          1. When there are unmerged paths in the index, the user likely\n             wants `git jump merge`.\n     @@ Commit message\n          2. When the working tree has unstaged changes, the user likely\n             wants `git jump diff`.\n      \n     -    Detect these two cases and dispatch to the corresponding mode\n     -    automatically, falling back to the existing usage-and-exit behavior\n     -    when neither holds.\n     +    3. In the presence of conflict markers or whitespace errors (as reported\n     +       by `git diff --check`), the user likely wants `git jump ws`.\n     +\n     +    In this commit we teach `git jump` a new \"auto\" mode which detects these\n     +    cases and dispatches to the corresponding mode automatically. The user\n     +    can either explicitly spell out `git jump auto`, or just leave it at\n     +    `git jump` (because \"auto\" is the default).\n     +\n     +    If none of the interesting cases listed above applies, then auto mode\n     +    falls back to the existing usage-and-exit behavior.\n      \n          Signed-off-by: Greg Hurrell <greg.hurrell@datadoghq.com>\n      \n       ## contrib/git-jump/README ##\n     -@@ contrib/git-jump/README: To use it, just drop git-jump in your PATH, and then invoke it like\n     - this:\n     +@@ contrib/git-jump/README: git jump grep foo_bar\n     + # arbitrary grep options\n     + git jump grep -i foo_bar\n       \n     - --------------------------------------------------\n     ++# jump to places with conflict markers or whitespace errors\n     ++# (as reported by # `git diff --check`)\n     ++git jump ws\n     ++\n     + # use the silver searcher for git jump grep\n     + git config jump.grepCmd \"ag --column\"\n     ++\n      +# pick a mode automatically: \"merge\" if there are unmerged paths,\n     -+# \"diff\" if the worktree has unstaged changes, otherwise show usage\n     -+git jump\n     ++# \"diff\" if the worktree has unstaged changes, \"ws\" if there are\n     ++# whitespace problems; otherwise show usage\n     ++git jump auto\n      +\n     - # jump to changes not yet staged for commit\n     - git jump diff\n     ++# with no explicit mode, same as \"auto\"\n     ++git jump\n     + --------------------------------------------------\n       \n     + You can use the optional argument '--stdout' to print the listing to\n      \n       ## contrib/git-jump/git-jump ##\n      @@\n     @@ contrib/git-jump/git-jump\n      +usage: git jump [--stdout] [<mode>] [<args>]\n       \n       Jump to interesting elements in an editor.\n     - The <mode> parameter is one of:\n     -@@ contrib/git-jump/git-jump: while test $# -gt 0; do\n     - \tshift\n     - done\n     - if test $# -lt 1; then\n     --\tusage >&2\n     --\texit 1\n     +-The <mode> parameter is one of:\n     ++The <mode> parameter is one of the following,\n     ++defaulting to \"auto\" if omitted:\n     + \n     + diff: elements are diff hunks. Arguments are given to diff.\n     + \n     +@@ contrib/git-jump/git-jump: grep: elements are grep hits. Arguments are given to git grep or, if\n     + \n     + ws: elements are whitespace errors. Arguments are given to diff --check.\n     + \n     ++auto: select one of the other modes based on worktree state;\n     ++      \"merge\" if there are unmerged paths, \"diff\" if there are\n     ++      unstaged changes, \"ws\" if there are whitespace errors.\n     ++\n     + If the optional argument `--stdout` is given, print the quickfix\n     + lines to standard output instead of feeding it to the editor.\n     + EOF\n     +@@ contrib/git-jump/git-jump: mode_ws() {\n     + \tgit diff --check \"$@\"\n     + }\n     + \n     ++mode_auto() {\n      +\tif test \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" != \"true\"; then\n      +\t\tusage >&2\n      +\t\texit 1\n      +\tfi\n     -+\tif test -n \"$(git ls-files -u)\"; then\n     -+\t\tset -- merge\n     -+\telif ! git diff --quiet; then\n     -+\t\tset -- diff\n     ++\tif test -n \"$(git ls-files -u \"$@\")\"; then\n     ++\t\tmode_merge \"$@\"\n     ++\telif ! git diff --quiet \"$@\"; then\n     ++\t\tmode_diff \"$@\"\n     ++\telif ! git diff --check >/dev/null 2>&1; then\n     ++\t\tmode_ws \"$@\"\n      +\telse\n      +\t\tusage >&2\n      +\t\texit 1\n      +\tfi\n     ++}\n     ++\n     + use_stdout=\n     + while test $# -gt 0; do\n     + \tcase \"$1\" in\n     +@@ contrib/git-jump/git-jump: while test $# -gt 0; do\n     + \tshift\n     + done\n     + if test $# -lt 1; then\n     +-\tusage >&2\n     +-\texit 1\n     ++\tset -- auto\n       fi\n       mode=$1; shift\n       type \"mode_$mode\" >/dev/null 2>&1 || { usage >&2; exit 1; }\n\n\n contrib/git-jump/README   | 12 ++++++++++++\n contrib/git-jump/git-jump | 29 +++++++++++++++++++++++++----\n 2 files changed, 37 insertions(+), 4 deletions(-)\n\ndiff --git a/contrib/git-jump/README b/contrib/git-jump/README\nindex 3211841305..ac35792e55 100644\n--- a/contrib/git-jump/README\n+++ b/contrib/git-jump/README\n@@ -75,8 +75,20 @@ git jump grep foo_bar\n # arbitrary grep options\n git jump grep -i foo_bar\n \n+# jump to places with conflict markers or whitespace errors\n+# (as reported by # `git diff --check`)\n+git jump ws\n+\n # use the silver searcher for git jump grep\n git config jump.grepCmd \"ag --column\"\n+\n+# pick a mode automatically: \"merge\" if there are unmerged paths,\n+# \"diff\" if the worktree has unstaged changes, \"ws\" if there are\n+# whitespace problems; otherwise show usage\n+git jump auto\n+\n+# with no explicit mode, same as \"auto\"\n+git jump\n --------------------------------------------------\n \n You can use the optional argument '--stdout' to print the listing to\ndiff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\nindex 8d1d5d79a6..43d3b42a41 100755\n--- a/contrib/git-jump/git-jump\n+++ b/contrib/git-jump/git-jump\n@@ -2,10 +2,11 @@\n \n usage() {\n \tcat <<\\EOF\n-usage: git jump [--stdout] <mode> [<args>]\n+usage: git jump [--stdout] [<mode>] [<args>]\n \n Jump to interesting elements in an editor.\n-The <mode> parameter is one of:\n+The <mode> parameter is one of the following,\n+defaulting to \"auto\" if omitted:\n \n diff: elements are diff hunks. Arguments are given to diff.\n \n@@ -16,6 +17,10 @@ grep: elements are grep hits. Arguments are given to git grep or, if\n \n ws: elements are whitespace errors. Arguments are given to diff --check.\n \n+auto: select one of the other modes based on worktree state;\n+      \"merge\" if there are unmerged paths, \"diff\" if there are\n+      unstaged changes, \"ws\" if there are whitespace errors.\n+\n If the optional argument `--stdout` is given, print the quickfix\n lines to standard output instead of feeding it to the editor.\n EOF\n@@ -82,6 +87,23 @@ mode_ws() {\n \tgit diff --check \"$@\"\n }\n \n+mode_auto() {\n+\tif test \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" != \"true\"; then\n+\t\tusage >&2\n+\t\texit 1\n+\tfi\n+\tif test -n \"$(git ls-files -u \"$@\")\"; then\n+\t\tmode_merge \"$@\"\n+\telif ! git diff --quiet \"$@\"; then\n+\t\tmode_diff \"$@\"\n+\telif ! git diff --check >/dev/null 2>&1; then\n+\t\tmode_ws \"$@\"\n+\telse\n+\t\tusage >&2\n+\t\texit 1\n+\tfi\n+}\n+\n use_stdout=\n while test $# -gt 0; do\n \tcase \"$1\" in\n@@ -99,8 +121,7 @@ while test $# -gt 0; do\n \tshift\n done\n if test $# -lt 1; then\n-\tusage >&2\n-\texit 1\n+\tset -- auto\n fi\n mode=$1; shift\n type \"mode_$mode\" >/dev/null 2>&1 || { usage >&2; exit 1; }\n\nbase-commit: 1c00d2d8392f603a6263f11f1a50fde96ae5475e\n-- \ngitgitgadget\n"},{"id":"543763","messageId":"xmqqik8h36al.fsf@gitster.g","threadId":"65608","inReplyTo":"pull.2108.v2.git.1779280307112.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] git-jump: pick a mode automatically when invoked without arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-21T01:22:42Z","receivedAt":"2026-05-21T01:22:46Z","isPatch":true,"body":"\"Greg Hurrell via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> If none of the interesting cases listed above applies, then auto mode\n> falls back to the existing usage-and-exit behavior.\n\nIf more than one interesting cases apply, what happens, and what\nshould happen?\n\n> diff --git a/contrib/git-jump/README b/contrib/git-jump/README\n> index 3211841305..ac35792e55 100644\n> --- a/contrib/git-jump/README\n> +++ b/contrib/git-jump/README\n> @@ -75,8 +75,20 @@ git jump grep foo_bar\n>  # arbitrary grep options\n>  git jump grep -i foo_bar\n>  \n> +# jump to places with conflict markers or whitespace errors\n> +# (as reported by # `git diff --check`)\n\nIs \"#\" after \"reported by\" intended?\n\n> diff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\n> index 8d1d5d79a6..43d3b42a41 100755\n> --- a/contrib/git-jump/git-jump\n> +++ b/contrib/git-jump/git-jump\n> @@ -2,10 +2,11 @@\n>  \n>  usage() {\n>  \tcat <<\\EOF\n> -usage: git jump [--stdout] <mode> [<args>]\n> +usage: git jump [--stdout] [<mode>] [<args>]\n\nSo \"git jump --stdout foo.c\" should mean \"git jump --stdout auto\nfoo.c\", OK.\n\n> @@ -16,6 +17,10 @@ grep: elements are grep hits. Arguments are given to git grep or, if\n>  \n>  ws: elements are whitespace errors. Arguments are given to diff --check.\n>  \n> +auto: select one of the other modes based on worktree state;\n> +      \"merge\" if there are unmerged paths, \"diff\" if there are\n> +      unstaged changes, \"ws\" if there are whitespace errors.\n> +\n>  If the optional argument `--stdout` is given, print the quickfix\n>  lines to standard output instead of feeding it to the editor.\n>  EOF\n> @@ -82,6 +87,23 @@ mode_ws() {\n>  \tgit diff --check \"$@\"\n>  }\n>  \n> +mode_auto() {\n> +\tif test \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" != \"true\"; then\n> +\t\tusage >&2\n> +\t\texit 1\n> +\tfi\n\nThat looks like a basic safety measure, which is good.\n\n> +\tif test -n \"$(git ls-files -u \"$@\")\"; then\n> +\t\tmode_merge \"$@\"\n> +\telif ! git diff --quiet \"$@\"; then\n> +\t\tmode_diff \"$@\"\n> +\telif ! git diff --check >/dev/null 2>&1; then\n\nShouldn't this \"diff --check\" be restricted by \"$@\" if given?\n\n> +\t\tmode_ws \"$@\"\n> +\telse\n> +\t\tusage >&2\n> +\t\texit 1\n> +\tfi\n> +}\n\n"},{"id":"543764","messageId":"xmqqecj535wx.fsf@gitster.g","threadId":"65608","inReplyTo":"xmqqik8h36al.fsf@gitster.g","subject":"Re: [PATCH v2] git-jump: pick a mode automatically when invoked without arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-21T01:30:54Z","receivedAt":"2026-05-21T01:30:59Z","isPatch":true,"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> +mode_auto() {\n>> +\tif test \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" != \"true\"; then\n>> +\t\tusage >&2\n>> +\t\texit 1\n>> +\tfi\n>\n> That looks like a basic safety measure, which is good.\n>\n>> +\tif test -n \"$(git ls-files -u \"$@\")\"; then\n>> +\t\tmode_merge \"$@\"\n>> +\telif ! git diff --quiet \"$@\"; then\n>> +\t\tmode_diff \"$@\"\n>> +\telif ! git diff --check >/dev/null 2>&1; then\n>\n> Shouldn't this \"diff --check\" be restricted by \"$@\" if given?\n\n>> +\t\tmode_ws \"$@\"\n\nIf there are any unstaged changes (possibly with whitespace errors),\n'git diff --quiet' would exit with non-zero, so \"elif ! git diff\n--quiet\" would be taken and we do mode_diff.  The user cannot rely\non \"auto\" to trigger mode_ws to check whitespace errors in the\nworking tree files because of this.  If there is no unstaged\nchanges, 'git diff --quiet' woudl exit with zero, so the control\ncomes to \"git diff --check\", but then there is nothing mode_ws to\nwork on in that case, right?  So it is not clear to me in what\nsituation this auto selection of mode_ws would help us.\n\n>> +\telse\n>> +\t\tusage >&2\n>> +\t\texit 1\n>> +\tfi\n>> +}\n"},{"id":"543828","messageId":"pull.2108.v3.git.1779371110195.gitgitgadget@gmail.com","threadId":"65608","inReplyTo":"pull.2108.v2.git.1779280307112.gitgitgadget@gmail.com","subject":"[PATCH v3] git-jump: pick a mode automatically when invoked without arguments","fromName":"Greg Hurrell via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2026-05-21T13:45:09Z","receivedAt":"2026-05-21T13:45:13Z","isPatch":true,"body":"From: Greg Hurrell <greg.hurrell@datadoghq.com>\n\nWhen `git jump` is invoked with no positional arguments (and no\narguments after `--stdout`) it currently prints usage and exits with\nstatus 1.\n\nBut there are two situations where we can usefully infer the most\nvaluable and likely mode that a user would want to use, and select it\nautomatically:\n\n1. When there are unmerged paths in the index, the user likely\n   wants `git jump merge`.\n\n2. When the working tree has unstaged changes, the user likely\n   wants `git jump diff`.\n\nIn this commit we teach `git jump` a new \"auto\" mode which detects these\ncases and dispatches to the corresponding mode automatically. The user\ncan either explicitly spell out `git jump auto`, or just leave it at\n`git jump` (because \"auto\" is the default).\n\nIf none of the interesting cases listed above applies, then auto mode\nfalls back to the existing usage-and-exit behavior.\n\nSigned-off-by: Greg Hurrell <greg.hurrell@datadoghq.com>\n---\n    git-jump: pick a mode automatically when invoked without arguments\n    \n    Changes since v2; all of these in response to feedback from Junio:\n    \n     * Removed stray # from README.\n     * Don't both teaching \"auto\" to select \"ws\" mode, because it is always\n       subsumed by \"diff\".\n     * Update usage string to make clear that git jump --stdout foo is not a\n       synonym for git jump --stdout auto foo, because distinguishing\n       between foo as <mode> and foo as <arg> is fraught with ambiguity.\n    \n    In answer to Junio's question:\n    \n    > If more than one interesting cases apply, what happens, and what\n    > should happen?\n    \n    it's an ordered choice (merge > diff).\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-2108%2Fwincent%2Fauto-jump-v3\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-2108/wincent/auto-jump-v3\nPull-Request: https://github.com/gitgitgadget/git/pull/2108\n\nRange-diff vs v2:\n\n 1:  5fbc8480ef ! 1:  af758dcfd2 git-jump: pick a mode automatically when invoked without arguments\n     @@ Commit message\n          arguments after `--stdout`) it currently prints usage and exits with\n          status 1.\n      \n     -    But there are several situations where we can usefully infer the most\n     +    But there are two situations where we can usefully infer the most\n          valuable and likely mode that a user would want to use, and select it\n          automatically:\n      \n     @@ Commit message\n          2. When the working tree has unstaged changes, the user likely\n             wants `git jump diff`.\n      \n     -    3. In the presence of conflict markers or whitespace errors (as reported\n     -       by `git diff --check`), the user likely wants `git jump ws`.\n     -\n          In this commit we teach `git jump` a new \"auto\" mode which detects these\n          cases and dispatches to the corresponding mode automatically. The user\n          can either explicitly spell out `git jump auto`, or just leave it at\n     @@ contrib/git-jump/README: git jump grep foo_bar\n       git jump grep -i foo_bar\n       \n      +# jump to places with conflict markers or whitespace errors\n     -+# (as reported by # `git diff --check`)\n     ++# (as reported by `git diff --check`)\n      +git jump ws\n      +\n       # use the silver searcher for git jump grep\n     @@ contrib/git-jump/README: git jump grep foo_bar\n      +# whitespace problems; otherwise show usage\n      +git jump auto\n      +\n     -+# with no explicit mode, same as \"auto\"\n     ++# with no explicit mode and no args, same as \"auto\"\n      +git jump\n       --------------------------------------------------\n       \n     @@ contrib/git-jump/README: git jump grep foo_bar\n      \n       ## contrib/git-jump/git-jump ##\n      @@\n     - \n       usage() {\n       \tcat <<\\EOF\n     --usage: git jump [--stdout] <mode> [<args>]\n     -+usage: git jump [--stdout] [<mode>] [<args>]\n     + usage: git jump [--stdout] <mode> [<args>]\n     ++   or: git jump [--stdout]\n       \n       Jump to interesting elements in an editor.\n      -The <mode> parameter is one of:\n     -+The <mode> parameter is one of the following,\n     -+defaulting to \"auto\" if omitted:\n     ++The <mode> parameter is one of the following.\n     ++With no <mode> and no <args>, it defaults to \"auto\".\n       \n       diff: elements are diff hunks. Arguments are given to diff.\n       \n     @@ contrib/git-jump/git-jump: mode_ws() {\n      +\t\tmode_merge \"$@\"\n      +\telif ! git diff --quiet \"$@\"; then\n      +\t\tmode_diff \"$@\"\n     -+\telif ! git diff --check >/dev/null 2>&1; then\n     -+\t\tmode_ws \"$@\"\n      +\telse\n      +\t\tusage >&2\n      +\t\texit 1\n\n\n contrib/git-jump/README   | 12 ++++++++++++\n contrib/git-jump/git-jump | 26 +++++++++++++++++++++++---\n 2 files changed, 35 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/git-jump/README b/contrib/git-jump/README\nindex 3211841305..aabec4a756 100644\n--- a/contrib/git-jump/README\n+++ b/contrib/git-jump/README\n@@ -75,8 +75,20 @@ git jump grep foo_bar\n # arbitrary grep options\n git jump grep -i foo_bar\n \n+# jump to places with conflict markers or whitespace errors\n+# (as reported by `git diff --check`)\n+git jump ws\n+\n # use the silver searcher for git jump grep\n git config jump.grepCmd \"ag --column\"\n+\n+# pick a mode automatically: \"merge\" if there are unmerged paths,\n+# \"diff\" if the worktree has unstaged changes, \"ws\" if there are\n+# whitespace problems; otherwise show usage\n+git jump auto\n+\n+# with no explicit mode and no args, same as \"auto\"\n+git jump\n --------------------------------------------------\n \n You can use the optional argument '--stdout' to print the listing to\ndiff --git a/contrib/git-jump/git-jump b/contrib/git-jump/git-jump\nindex 8d1d5d79a6..79286d8112 100755\n--- a/contrib/git-jump/git-jump\n+++ b/contrib/git-jump/git-jump\n@@ -3,9 +3,11 @@\n usage() {\n \tcat <<\\EOF\n usage: git jump [--stdout] <mode> [<args>]\n+   or: git jump [--stdout]\n \n Jump to interesting elements in an editor.\n-The <mode> parameter is one of:\n+The <mode> parameter is one of the following.\n+With no <mode> and no <args>, it defaults to \"auto\".\n \n diff: elements are diff hunks. Arguments are given to diff.\n \n@@ -16,6 +18,10 @@ grep: elements are grep hits. Arguments are given to git grep or, if\n \n ws: elements are whitespace errors. Arguments are given to diff --check.\n \n+auto: select one of the other modes based on worktree state;\n+      \"merge\" if there are unmerged paths, \"diff\" if there are\n+      unstaged changes, \"ws\" if there are whitespace errors.\n+\n If the optional argument `--stdout` is given, print the quickfix\n lines to standard output instead of feeding it to the editor.\n EOF\n@@ -82,6 +88,21 @@ mode_ws() {\n \tgit diff --check \"$@\"\n }\n \n+mode_auto() {\n+\tif test \"$(git rev-parse --is-inside-work-tree 2>/dev/null)\" != \"true\"; then\n+\t\tusage >&2\n+\t\texit 1\n+\tfi\n+\tif test -n \"$(git ls-files -u \"$@\")\"; then\n+\t\tmode_merge \"$@\"\n+\telif ! git diff --quiet \"$@\"; then\n+\t\tmode_diff \"$@\"\n+\telse\n+\t\tusage >&2\n+\t\texit 1\n+\tfi\n+}\n+\n use_stdout=\n while test $# -gt 0; do\n \tcase \"$1\" in\n@@ -99,8 +120,7 @@ while test $# -gt 0; do\n \tshift\n done\n if test $# -lt 1; then\n-\tusage >&2\n-\texit 1\n+\tset -- auto\n fi\n mode=$1; shift\n type \"mode_$mode\" >/dev/null 2>&1 || { usage >&2; exit 1; }\n\nbase-commit: aec3f587505a472db67e9462d0702e7d463a449d\n-- \ngitgitgadget\n"},{"id":"543829","messageId":"xmqqlddczwtt.fsf@gitster.g","threadId":"65608","inReplyTo":"pull.2108.v3.git.1779371110195.gitgitgadget@gmail.com","subject":"Re: [PATCH v3] git-jump: pick a mode automatically when invoked without arguments","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-05-21T14:00:46Z","receivedAt":"2026-05-21T14:00:49Z","isPatch":true,"body":"\"Greg Hurrell via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n>      * Removed stray # from README.\n>      * Don't both teaching \"auto\" to select \"ws\" mode, because it is always\n>        subsumed by \"diff\".\n>      * Update usage string to make clear that git jump --stdout foo is not a\n>        synonym for git jump --stdout auto foo, because distinguishing\n>        between foo as <mode> and foo as <arg> is fraught with ambiguity.\n>     \n>     In answer to Junio's question:\n>     \n>     > If more than one interesting cases apply, what happens, and what\n>     > should happen?\n>     \n>     it's an ordered choice (merge > diff).\n\nAfter 'diff --quiet \"$@\"' says \"nothing interesting between the\nindex and the working tree\", I actually think it may be worth using\neither 'git diff --check HEAD \"$@\"' or 'git diff --cached --check \"$@\"'\nto see if ws fix is needed.\n\nBut I am not a target audience of this feature, so I'll let others\nfigure out what to do here.\n"},{"id":"543880","messageId":"20260522052821.GC861761@coredump.intra.peff.net","threadId":"65608","inReplyTo":"pull.2108.v3.git.1779371110195.gitgitgadget@gmail.com","subject":"Re: [PATCH v3] git-jump: pick a mode automatically when invoked without arguments","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2026-05-22T05:28:21Z","receivedAt":"2026-05-22T05:28:22Z","isPatch":true,"body":"On Thu, May 21, 2026 at 01:45:09PM +0000, Greg Hurrell via GitGitGadget wrote:\n\n>     Changes since v2; all of these in response to feedback from Junio:\n>     \n>      * Removed stray # from README.\n>      * Don't both teaching \"auto\" to select \"ws\" mode, because it is always\n>        subsumed by \"diff\".\n>      * Update usage string to make clear that git jump --stdout foo is not a\n>        synonym for git jump --stdout auto foo, because distinguishing\n>        between foo as <mode> and foo as <arg> is fraught with ambiguity.\n>     \n>     In answer to Junio's question:\n>     \n>     > If more than one interesting cases apply, what happens, and what\n>     > should happen?\n>     \n>     it's an ordered choice (merge > diff).\n\nDropping the \"ws\" mode from auto makes sense to me. It could be slotted\nin between \"merge\" and \"diff\" (a whitespace problem always implies a\ndiff, but a diff does not always imply a whitespace problem). But would\nthat actually be useful?\n\nMy impression of the \"auto\" feature is: I am too lazy to type, so just\ntake me to the interesting bits. And interesting in my experience with\ngit-jump is either \"I am merging, take me to the conflict\" or \"I am\nwriting new code, take me to what I already did\". Limiting the second\ncase just to whitespace violations (assuming there is at least one)\nwould probably be more confusing than helpful.\n\nYou could perhaps argue for one more layer of \"interesting\", which is:\nif there are no unstaged changes, take me to the staged ones. Looking at\nstaged changes can be misleading if the working tree file has moved on\n(since by definition we are dumping the editor into the working tree\nfile, not the staged contents). But if we know the diff between index\nand working tree is empty, then that is not an issue.\n\nI do sometimes use \"git jump diff --cached\" explicitly for that purpose.\n\nIf sounds like Greg has been living with \"auto\" and finding it useful\nfor a while. So I'm mostly inclined to take the patch as-is, and people\ncan experiment with it and suggest changes after using it in practice.\n\nBut here's my one final thought. The hierarchy of \"merge > diff > diff\n--cached\", etc, makes me wonder if we could simply concatenate the\noutputs.  I.e., show all of the merge conflicts and all of the diffs,\nwhitespace changes, and so on. But I guess you run into two issues:\n\n  1. There will be duplicates. Every merge conflict is also a diff. And\n     every whitespace violation is also a diff. So at the very least you\n     need to de-dup these (which might not be entirely trivial, as they\n     may overlap rather than starting at the same line).\n\n  2. When resolving a merge, I'm not sure if the diffs are actually\n     interesting. Usually I git-jump around until there are no more\n     conflicts, and then I see if it builds. But I almost never want to\n     jump to the other changes introduced by the side-branch. There are\n     too many of them, and they are probably uninteresting. So adding\n     both \"merge\" and \"diff\" elements to the quicklist would be\n     annoying.\n\n-Peff\n"},{"id":"543895","messageId":"3c0edf5a-761a-4b79-bf3a-fcf336a986e8@app.fastmail.com","threadId":"65608","inReplyTo":"20260522052821.GC861761@coredump.intra.peff.net","subject":"Re: [PATCH v3] git-jump: pick a mode automatically when invoked without arguments","fromName":"Greg Hurrell","fromEmail":"greg@hurrell.net","sentAt":"2026-05-22T07:33:04Z","receivedAt":"2026-05-22T07:33:26Z","isPatch":true,"body":"On Fri, May 22, 2026, at 7:28 AM, Jeff King wrote:\n> \n> My impression of the \"auto\" feature is: I am too lazy to type, so just\n> take me to the interesting bits. And interesting in my experience with\n> git-jump is either \"I am merging, take me to the conflict\" or \"I am\n> writing new code, take me to what I already did\". Limiting the second\n> case just to whitespace violations (assuming there is at least one)\n> would probably be more confusing than helpful.\n\n> If sounds like Greg has been living with \"auto\" and finding it useful\n> for a while. So I'm mostly inclined to take the patch as-is, and people\n> can experiment with it and suggest changes after using it in practice.\n\nYes, the \"take me to the interesting bits\" is very much the mental model\nI've been operating with, using the simplest definition of \"interesting\"\n(\"merge conflicts\", followed by \"changes in the worktree\"). I think that\nstarting simple, but leaving the door open to possibly introducing more\nsubtleties in the future makes the most sense.\n\n- Greg\n"},{"id":"544128","messageId":"ahYN_FeSileUJLGl@mbp","threadId":"65608","inReplyTo":"20260522052821.GC861761@coredump.intra.peff.net","subject":"Re: [PATCH v3] git-jump: pick a mode automatically when invoked without arguments","fromName":"Erik Cervin Edin","fromEmail":"erik@cervined.in","sentAt":"2026-05-26T21:33:21Z","receivedAt":"2026-05-26T21:33:25Z","isPatch":true,"body":"On 26/05/22 01:28AM, Jeff King wrote:\n> On Thu, May 21, 2026 at 01:45:09PM +0000, Greg Hurrell via GitGitGadget wrote:\n> \n> >      * Don't both teaching \"auto\" to select \"ws\" mode, because it is always\n> >        subsumed by \"diff\".\n> \n> Dropping the \"ws\" mode from auto makes sense to me. It could be slotted\n> in between \"merge\" and \"diff\" (a whitespace problem always implies a\n> diff, but a diff does not always imply a whitespace problem). But would\n> that actually be useful?\n\nWhen I originally proposed the idea of a third branch, there was a\nsubtle difference -- it was a git diff --cached --check.\n\nOn 26/05/14 05:40PM, Erik Cervin Edin wrote:\n> If we're going to teach git-jump how to be more clever about where to jump,\n> does it also make sense to bake `git jump ws` into this?\n> \n>         elif ! git diff --cached --check >/dev/null 2>&1; then\n>             mode_ws --cached \"$@\"\n\nEver so often I come across file with a diff --check offending\nwhite-space (often a missing newline at the end of some file) and\nbecause I have a commit hook set up, I have to go looking for where that\nerror is. In this particular case it's always a staged change, and then\na *staged* white space problem doesn't imply a diff.\n\nThis happens rarely enough that I haven't internalized that I can use\n\"git jump diff --check --cached\" and it takes me a while to navigate to\nthe offending files.\n\nBut the main suggestion was really considering the possibility to\nexpand this beyond these two auto jumps in the future -- I'm not sure\nan auto jump that goes looking for staged white spaces issues would be\nuseful to anyone in practise and at this stage I thinks it's best to\ndrop it.\n"}]}