git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] checkout: add --autostash option for branch switching

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 13, 2026, 17:16 UTC
Message-ID
<xmqqv7ez6455.fsf@gitster.g>
In-Reply-To
<pull.2234.v3.git.git.1773393818235.gitgitgadget@gmail.com>
"Harald Nordgren via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 21 quoted lines
> From: Harald Nordgren <haraldnordgren@gmail.com>
>
> When switching branches, local modifications in the working tree can
> prevent the checkout from succeeding.  While "git rebase" and "git
> merge" already support --autostash to handle this case automatically,
> "git checkout" and "git switch" require users to manually stash and
> unstash their changes.
>
> Teach "git checkout" and "git switch" to accept --autostash and
> --no-autostash options that automatically create a temporary stash
> entry before the branch switch begins and apply it after the switch
> completes.  If the stash application results in conflicts, the stash
> entry is saved to the stash list so the user can resolve them later.
>
> Also add a checkout.autoStash configuration option that enables this
> behavior by default, which can be overridden with --no-autostash on
> the command line.
>
> Signed-off-by: Harald Nordgren <haraldnordgren@gmail.com>
> ---
>     checkout: 'autostash' for branch switching

Almost all of the above is now stale, as we no longer call this the "autostash" feature. It turned into a project to vastly improve the "checkout --merge" option, so the proposed log message needs to be revamped to match.

Using the autostash mechanism to simplify checkout.c is a great direction, I think, provided we can maintain the high-quality conflict information (branch labels) that users expect from '-m'.

For a new iteration that invalidates almost everything from the previous round, it is easier if range-diff were omitted from the reviewers' point of view (I am not a GGG user, so I do not know if there is such an option to do so). It is not a huge deal as we can simply ignore the large block of lines as irrelevant ;-)

Show 24 quoted lines
>  Documentation/git-checkout.adoc |  50 +++++-----
>  Documentation/git-switch.adoc   |  26 ++---
>  builtin/checkout.c              | 160 +++++++++++++++---------------
>  sequencer.c                     |   2 +-
>  t/t7201-co.sh                   | 170 +++++++++++++++++++++++++++++++-
>  xdiff-interface.c               |  12 +++
>  xdiff-interface.h               |   1 +
>  7 files changed, 293 insertions(+), 128 deletions(-)
>
> diff --git a/Documentation/git-checkout.adoc b/Documentation/git-checkout.adoc
> index 43ccf47cf6..1e8adf6ef3 100644
> --- a/Documentation/git-checkout.adoc
> +++ b/Documentation/git-checkout.adoc
> @@ -251,20 +251,17 @@ working tree, by copying them from elsewhere, extracting a tarball, etc.
>  	are different between the current branch and the branch to
>  	which you are switching, the command refuses to switch
>  	branches in order to preserve your modifications in context.
> +	With this option, the conflicting local changes are
> +	automatically stashed before the switch and reapplied
> +	afterwards.  If the local changes do not overlap with the
> +	differences between branches, the switch proceeds without
> +	stashing.  If reapplying the stash results in conflicts, the
> +	entry is saved to the stash list so you can use `git stash
> +	pop` to recover and `git stash drop` when done.
Great.
> -+
> -When switching branches with `--merge`, staged changes may be lost.

Hmph, I have to admit that I never do "checkout" to go to a different branch with a dirty index that does not match the current HEAD, with or without "--merge"; in fact, not just "I never do" myself, I never thought about what happens when somebody does so, so I do not offhand know what the current code without this patch does, or what the updated code would. In "stash && switch && unstash" flow, the last "unstash" is what decides if the original changes in the index is reapplied to the index or not, IIRC, so we still may lose the distinction between what has been and what has not been added to the index after all, depending on the way how the new code does the "unstash" step.

Show 20 quoted lines
> @@ -578,39 +575,36 @@ $ git checkout mytopic
>  error: You have local changes to 'frotz'; not switching branches.
>  ------------
>  
> -You can give the `-m` flag to the command, which would try a
> -three-way merge:
> +You can give the `-m` flag to the command, which would save the local
> +changes in a stash entry and reset the working tree to allow switching:
>  
>  ------------
>  $ git checkout -m mytopic
> -Auto-merging frotz
> +Created autostash: 7a9afa3
> +Applied autostash.
>  ------------
>  
> -After this three-way merge, the local modifications are _not_
> +After the switch, the local modifications are reapplied and are _not_
>  registered in your index file, so `git diff` would show you what
>  changes you made since the tip of the new branch.
OK.
Show 7 quoted lines
>  === 3. Merge conflict
>  
> -When a merge conflict happens during switching branches with
> -the `-m` option, you would see something like this:
> +When the locally modified files overlap with files that need to be
> +updated by the branch switch, the changes are stashed and reapplied
> +after the switch.  If the stash application results in conflicts,

In the original text of this third example (and as I understand, these examples are written to be read more-or-less independently), the `-m` option was explicitly mentioned to make it clear that this "conflict" situation is relevant only when the option is used. In the updated text, it is not. We should mention `-m` somewhere in the updated text as well: When the `--merge` (`-m`) option is in effect, _this_ happens.

Show 12 quoted lines
> +they are not resolved and the stash is saved to the stash list:
>  
>  ------------
>  $ git checkout -m mytopic
> -Auto-merging frotz
> -ERROR: Merge conflict in frotz
> -fatal: merge program failed
> +Created autostash: 7a9afa3
> +Applying autostash resulted in conflicts.
> +Your changes are safe in the stash.
> +You can run "git stash pop" or "git stash drop" at any time.
>  ------------

Nice. It may probably be on a bit too verbose side, though. The fact we are creating a stash entry or the object name of it is not interesting to the user unless there is a conflict, so I would have thought we would not say "Created autostash" at all, and the last three lines would be replaced with something like the following and shown _only_ when the application of the stashed changes did not succeed cleanly:

    Your local changes are stashed, however, applying it to carry
    forward your local changes resulted in conflicts:
     - You can try resolving them now.  If you resolved them
       successfully, discard the stash entry with "git stash drop".
     - Alternatively you can "git reset --hard" if you do not want
       to deal with them right now, and later "git stash pop" to
       recover your local changes.
Show 9 quoted lines
> -At this point, `git diff` shows the changes cleanly merged as in
> -the previous example, as well as the changes in the conflicted
> -files.  Edit and resolve the conflict and mark it resolved with
> -`git add` as usual:
> -
> -------------
> -$ edit frotz
> -$ git add frotz
> -------------

After resolving and adding, they need to do "git stash drop" it, but other than that, this part of the example is still valid, isn't it?

The improvement this patch brings in is that the user now has another choice, i.e.,

    Instead of editing and resolving the conflicts right now, you
    can clear the slate with `git reset --hard` and resurrect the
    local changes, safely stored in the stash at your leisure, with
    `git stash pop`.
> +At this point, `git stash pop` can be used to recover and resolve
> +the conflicts, and `git stash drop` to discard the stash when done.

This is not giving a wrong instruction per-se, but my suggestion above can be used to extend it if we wanted to. It may make it easier to understand to the readers, or it may make it way too verbose. I dunno.

Show 35 quoted lines
> diff --git a/builtin/checkout.c b/builtin/checkout.c
> index 1d1667fa4c..d3b3b815a7 100644
> --- a/builtin/checkout.c
> +++ b/builtin/checkout.c
> @@ -17,7 +17,6 @@
>  #include "merge-ll.h"
>  #include "lockfile.h"
>  #include "mem-pool.h"
> -#include "merge-ort-wrappers.h"
>  #include "object-file.h"
>  #include "object-name.h"
>  #include "odb.h"
> @@ -30,6 +29,7 @@
>  #include "repo-settings.h"
>  #include "resolve-undo.h"
>  #include "revision.h"
> +#include "sequencer.h"
>  #include "setup.h"
>  #include "submodule.h"
>  #include "symlinks.h"
> @@ -845,83 +845,8 @@ static int merge_working_tree(const struct checkout_opts *opts,
>  
>  		ret = unpack_trees(2, trees, &topts);
>  		clear_unpack_trees_porcelain(&topts);
> -		if (ret == -1) {
> -			/*
> -			 * Unpack couldn't do a trivial merge; either
> -			 * give up or do a real merge, depending on
> -			 * whether the merge flag was used.
> -			 */
> -...
> -		}
> +		if (ret == -1)
> +			return 1;
>  	}
So pleased to see so much custom code getting removed ;-).
Show 13 quoted lines
> diff --git a/sequencer.c b/sequencer.c
> index aafd0bc959..72f0afe609 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -4677,7 +4677,7 @@ static void create_autostash_internal(struct repository *r,
>  					&oid, null_oid(the_hash_algo), 0, UPDATE_REFS_DIE_ON_ERR);
>  		}
>  
> -		printf(_("Created autostash: %s\n"), buf.buf);
> +		fprintf(stderr, _("Created autostash: %s\n"), buf.buf);
>  		if (reset_head(r, &ropts) < 0)
>  			die(_("could not reset --hard"));
>  		discard_index(r->index);

Is this change something all the callers that passes control through this part desire? Don't some of them want the output go to the standard output, not standard error?

If we are going in the direction I suggested above (i.e., be silent about our use of stashes before it becomes relevant to the user), this part may have to become a conditional

	if (!silent)
		printf(_("Created autostash: %s\n"), buf.buf);

or something, where all the current callers before the "checkout --merge" adds a new caller would pass silent==0 to.

Whatever changes this function needs, it looks more like a separate preparatory patch to me.

Show 21 quoted lines
> diff --git a/t/t7201-co.sh b/t/t7201-co.sh
> index 9bcf7c0b40..9ace3962ba 100755
> --- a/t/t7201-co.sh
> +++ b/t/t7201-co.sh
> @@ -171,14 +171,14 @@ test_expect_success 'format of merge conflict from checkout -m' '
>  	test_cmp expect current &&
>  
>  	cat <<-EOF >expect &&
> -	<<<<<<< simple
> +	<<<<<<< Updated upstream
>  	a
>  	c
>  	e
>  	=======
>  	b
>  	d
> -	>>>>>>> local
> +	>>>>>>> Stashed changes
>  	EOF
>  	test_cmp expect two
>  '

Historically, 'git checkout -m' provided the branch names (e.g., "<<<<<<< simple"), which is very helpful context. It would be great if we could find a way to pass the branch names through as labels to the stash application. It may require a preparatory change to "git stash apply" to allow customizing the labels---the underlying machinery at the lowest level does have ability to use labels the callers want it to use, so it may be just the matter of plumbing it through the callchain. I didn't check.

Show 35 quoted lines
> diff --git a/xdiff-interface.c b/xdiff-interface.c
> index f043330f2a..5ee2b96d0a 100644
> --- a/xdiff-interface.c
> +++ b/xdiff-interface.c
> @@ -325,6 +325,18 @@ int parse_conflict_style_name(const char *value)
>  		return -1;
>  }
>  
> +const char *conflict_style_name(int style)
> +{
> +	switch (style) {
> +	case XDL_MERGE_DIFF3:
> +		return "diff3";
> +	case XDL_MERGE_ZEALOUS_DIFF3:
> +		return "zdiff3";
> +	default:
> +		return "merge";
> +	}
> +}
> +
>  int git_xmerge_style = -1;
>  
>  int git_xmerge_config(const char *var, const char *value,
> diff --git a/xdiff-interface.h b/xdiff-interface.h
> index fbc4ceec40..ce54e1c0e0 100644
> --- a/xdiff-interface.h
> +++ b/xdiff-interface.h
> @@ -55,6 +55,7 @@ void xdiff_set_find_func(xdemitconf_t *xecfg, const char *line, int cflags);
>  void xdiff_clear_find_func(xdemitconf_t *xecfg);
>  struct config_context;
>  int parse_conflict_style_name(const char *value);
> +const char *conflict_style_name(int style);
>  int git_xmerge_config(const char *var, const char *value,
>  		      const struct config_context *ctx, void *cb);
>  extern int git_xmerge_style;

This may be a useful addition, but it would probably need to become a separate preparatory patch, possibly with its own test.

Previous: Harald Nordgren via GitGitGadgetNext: Harald Nordgren
Message 21 of 164 in “checkout: add --autostash option for branch switching”
  1. checkout: add --autostash option for branch switchingHarald Nordgren via GitGitGadget, Mar 12, 2026
  2. Junio C HamanoMar 12, 2026
  3. Harald NordgrenMar 12, 2026
  4. Phillip WoodMar 13, 2026
  5. Junio C HamanoMar 14, 2026
  6. Phillip WoodMar 16, 2026
  7. Junio C HamanoMar 16, 2026
  8. Harald NordgrenMar 17, 2026
  9. Harald NordgrenMar 19, 2026
  10. Junio C HamanoMar 19, 2026
  11. Harald NordgrenMar 31, 2026
  12. Harald NordgrenApr 9, 2026
  13. Harald NordgrenApr 9, 2026
  14. Junio C HamanoApr 9, 2026
  15. Harald NordgrenApr 9, 2026
  16. Harald NordgrenApr 9, 2026
  17. checkout: add --autostash option for branch switchingHarald Nordgren via GitGitGadget, Mar 12, 2026
  18. Junio C HamanoMar 12, 2026
  19. Harald NordgrenMar 13, 2026
  20. checkout: add --autostash option for branch switchingHarald Nordgren via GitGitGadget, Mar 13, 2026
  21. Junio C HamanoMar 13, 2026
  22. Harald NordgrenMar 13, 2026
  23. Junio C HamanoMar 13, 2026
  24. checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Mar 14, 2026
  25. Junio C HamanoMar 15, 2026
  26. 0/4 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Mar 15, 2026
  27. 1/4 stash: add --ours-label, --theirs-label, --base-label for applyHarald Nordgren via GitGitGadget, Mar 15, 2026
  28. 2/4 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Mar 15, 2026
  29. 3/4 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Mar 15, 2026
  30. 4/4 checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Mar 15, 2026
  31. 0/4 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Mar 17, 2026
  32. 1/4 stash: add --ours-label, --theirs-label, --base-label for applyHarald Nordgren via GitGitGadget, Mar 17, 2026
  33. 2/4 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Mar 17, 2026
  34. 3/4 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Mar 17, 2026
  35. 4/4 checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Mar 17, 2026
  36. 0/4 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 9, 2026
  37. 1/4 stash: add --ours-label, --theirs-label, --base-label for applyHarald Nordgren via GitGitGadget, Apr 9, 2026
  38. Junio C HamanoApr 9, 2026
  39. Harald NordgrenApr 9, 2026
  40. 2/4 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 9, 2026
  41. 3/4 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 9, 2026
  42. Junio C HamanoApr 9, 2026
  43. Harald NordgrenApr 9, 2026
  44. 4/4 checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 9, 2026
  45. Junio C HamanoApr 9, 2026
  46. Harald NordgrenApr 9, 2026
  47. Junio C HamanoApr 9, 2026
  48. Harald NordgrenApr 9, 2026
  49. 0/4 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 9, 2026
  50. 1/4 stash: add --ours-label, --theirs-label, --base-label for applyHarald Nordgren via GitGitGadget, Apr 9, 2026
  51. Phillip WoodApr 10, 2026
  52. Junio C HamanoApr 10, 2026
  53. Harald NordgrenApr 10, 2026
  54. 2/4 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 9, 2026
  55. Phillip WoodApr 10, 2026
  56. Junio C HamanoApr 10, 2026
  57. Harald NordgrenApr 10, 2026
  58. 3/4 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 9, 2026
  59. Phillip WoodApr 10, 2026
  60. Junio C HamanoApr 10, 2026
  61. Harald NordgrenApr 10, 2026
  62. 4/4 checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 9, 2026
  63. Chris TorekApr 9, 2026
  64. Harald NordgrenApr 10, 2026
  65. 0/4 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 10, 2026
  66. 1/4 stash: add --label-ours, --label-theirs, --label-base for applyHarald Nordgren via GitGitGadget, Apr 10, 2026
  67. 3/4 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 10, 2026
  68. 4/4 checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 10, 2026
  69. Jeff KingApr 11, 2026
  70. Harald NordgrenApr 11, 2026
  71. Jeff KingApr 11, 2026
  72. Jeff KingApr 11, 2026
  73. 2/4 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 10, 2026
  74. Junio C HamanoApr 10, 2026
  75. 0/4 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 12, 2026
  76. 1/4 stash: add --label-ours, --label-theirs, --label-base for applyHarald Nordgren via GitGitGadget, Apr 12, 2026
  77. 2/4 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 12, 2026
  78. 3/4 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 12, 2026
  79. 4/4 checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 12, 2026
  80. Jeff KingApr 12, 2026
  81. Junio C HamanoApr 13, 2026
  82. Harald NordgrenApr 14, 2026
  83. Junio C HamanoApr 14, 2026
  84. Junio C HamanoApr 14, 2026
  85. Junio C HamanoApr 14, 2026
  86. 0/4 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 14, 2026
  87. 1/4 stash: add --label-ours, --label-theirs, --label-base for applyHarald Nordgren via GitGitGadget, Apr 14, 2026
  88. 2/4 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 14, 2026
  89. 3/4 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 14, 2026
  90. 4/4 checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 14, 2026
  91. 0/4 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 14, 2026
  92. 1/4 stash: add --label-ours, --label-theirs, --label-base for applyHarald Nordgren via GitGitGadget, Apr 14, 2026
  93. Phillip WoodApr 14, 2026
  94. Junio C HamanoApr 14, 2026
  95. Harald NordgrenApr 14, 2026
  96. Harald NordgrenApr 14, 2026
  97. Phillip WoodApr 15, 2026
  98. Harald NordgrenApr 15, 2026
  99. 2/4 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 14, 2026
  100. Phillip WoodApr 14, 2026
  101. Harald NordgrenApr 14, 2026
  102. 3/4 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 14, 2026
  103. Phillip WoodApr 14, 2026
  104. Harald NordgrenApr 14, 2026
  105. 4/4 checkout: -m (--merge) uses autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 14, 2026
  106. Phillip WoodApr 14, 2026
  107. Junio C HamanoApr 14, 2026
  108. Harald NordgrenApr 14, 2026
  109. Phillip WoodApr 15, 2026
  110. Harald NordgrenApr 14, 2026
  111. Harald NordgrenApr 15, 2026
  112. Phillip WoodApr 15, 2026
  113. Harald NordgrenApr 15, 2026
  114. Phillip WoodApr 15, 2026
  115. Junio C HamanoApr 14, 2026
  116. Harald NordgrenApr 14, 2026
  117. Junio C HamanoApr 14, 2026
  118. Harald NordgrenApr 16, 2026
  119. Junio C HamanoApr 16, 2026
  120. Harald NordgrenApr 16, 2026
  121. 0/5 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 15, 2026
  122. 1/5 stash: add --label-ours, --label-theirs, --label-base for applyHarald Nordgren via GitGitGadget, Apr 15, 2026
  123. 2/5 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 15, 2026
  124. 3/5 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 15, 2026
  125. 4/5 checkout: rollback lock on early returns in merge_working_treeHarald Nordgren via GitGitGadget, Apr 15, 2026
  126. 5/5 checkout -m: autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 15, 2026
  127. 0/5 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 15, 2026
  128. 1/5 stash: add --label-ours, --label-theirs, --label-base for applyHarald Nordgren via GitGitGadget, Apr 15, 2026
  129. 2/5 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 15, 2026
  130. 3/5 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 15, 2026
  131. 4/5 checkout: rollback lock on early returns in merge_working_treeHarald Nordgren via GitGitGadget, Apr 15, 2026
  132. 5/5 checkout -m: autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 15, 2026
  133. Phillip WoodApr 24, 2026
  134. Comments on Phillip's reviewHarald Nordgren, Apr 24, 2026
  135. Harald NordgrenApr 21, 2026
  136. Phillip WoodApr 21, 2026
  137. Harald NordgrenApr 22, 2026
  138. Phillip WoodApr 24, 2026
  139. 0/5 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 24, 2026
  140. 1/5 stash: add --label-ours, --label-theirs, --label-base for applyHarald Nordgren via GitGitGadget, Apr 24, 2026
  141. Phillip WoodApr 28, 2026
  142. checkout: add --autostash option for branch switchingHarald Nordgren, Apr 28, 2026
  143. 2/5 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 24, 2026
  144. Phillip WoodApr 28, 2026
  145. 3/5 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 24, 2026
  146. Phillip WoodApr 28, 2026
  147. checkout: add --autostash option for branch switchingHarald Nordgren, Apr 28, 2026
  148. 4/5 checkout: rollback lock on early returns in merge_working_treeHarald Nordgren via GitGitGadget, Apr 24, 2026
  149. Phillip WoodApr 28, 2026
  150. 5/5 checkout -m: autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 24, 2026
  151. Phillip WoodApr 28, 2026
  152. checkout: add --autostash option for branch switchingHarald Nordgren, Apr 28, 2026
  153. Phillip WoodApr 28, 2026
  154. 0/5 checkout: 'autostash' for branch switchingHarald Nordgren via GitGitGadget, Apr 28, 2026
  155. 1/5 stash: add --label-ours, --label-theirs, --label-base for applyHarald Nordgren via GitGitGadget, Apr 28, 2026
  156. 2/5 sequencer: allow create_autostash to run silentlyHarald Nordgren via GitGitGadget, Apr 28, 2026
  157. 3/5 sequencer: teach autostash apply to take optional conflict marker labelsHarald Nordgren via GitGitGadget, Apr 28, 2026
  158. 4/5 checkout: rollback lock on early returns in merge_working_treeHarald Nordgren via GitGitGadget, Apr 28, 2026
  159. 5/5 checkout -m: autostash when switching branchesHarald Nordgren via GitGitGadget, Apr 28, 2026
  160. Phillip WoodApr 29, 2026
  161. Phillip WoodApr 29, 2026
  162. checkout: add --autostash option for branch switchingHarald Nordgren, Apr 29, 2026
  163. 0/5 checkout: 'autostash' for branch switchingHarald Nordgren, May 7, 2026
  164. Phillip WoodMay 8, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.