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

Re: Git automatic stashing?

From
Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Date
Nov 9, 2010, 12:58 UTC
Message-ID
<AANLkTin-qFrTnu+ZUx45Gbk_3m3843T1+n+aj3agwfzD@mail.gmail.com>
In-Reply-To
<AANLkTi=G=Xo90QayvuRDp=GTWtkES2fU0kkmn87Q09_2@mail.gmail.com>
On Tue, Nov 9, 2010 at 7:36 AM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:
Show 7 quoted lines
> On Tue, Nov 9, 2010 at 12:37 PM, Casey McGinty <casey.mcginty@gmail.com> wrote:
>> Is there any feature in git to perform and auto stash apply/pop when
>> trying to do a merge/rebase in a dirty working dir? This would save
>> some keystrokes from time-to-time, and make it easier for new users
>> unfamiliar with git.
>
> And when switching branches too.

When switching branches (or checking out a different commit in general), I think git allows you to check out as long as the files that need to be replaced have not been updated, much like when merging. As far as I can see, that makes the benefit of temporarily stashing changes much smaller (but not non-existent) in these two cases (checkout and merge) than it is when rebasing.

Thinking a bit more about it, I think you are right, though, that it would still be a nice-to-have, as an option. Currently, 'git rebase' is more restrictive than 'git merge', but adding the option to 'git rebase' would not just make it on par with 'git merge', but would actually make it less restrictive than 'git merge', as even non-conflicting changes within files would be automatically handled.

Previous: Nguyen Thai Ngoc DuyNext: Matthieu Moy
Message 5 of 7 in “Git automatic stashing?”
  1. Casey McGintyNov 9, 2010
  2. Matthieu MoyNov 9, 2010
  3. Martin von ZweigbergkNov 9, 2010
  4. Nguyen Thai Ngoc DuyNov 9, 2010
  5. Martin von ZweigbergkNov 9, 2010
  6. Matthieu MoyNov 9, 2010
  7. Thomas RastNov 9, 2010

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.