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

Re: [PATCH 1/2] pull: respect rebase.autostash

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 14, 2013, 18:26 UTC
Message-ID
<7vk3lwo8fw.fsf@alter.siamese.dyndns.org>
In-Reply-To
<vpqfvwlkqb5.fsf@anie.imag.fr>
Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
Show 24 quoted lines
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
>> --- a/git-pull.sh
>> +++ b/git-pull.sh
>> @@ -44,6 +44,7 @@ merge_args= edit=
>>  curr_branch=$(git symbolic-ref -q HEAD)
>>  curr_branch_short="${curr_branch#refs/heads/}"
>>  rebase=$(git config --bool branch.$curr_branch_short.rebase)
>> +autostash=$(git config --bool rebase.autostash)
>>  if test -z "$rebase"
>>  then
>>  	rebase=$(git config --bool pull.rebase)
>> @@ -203,6 +204,7 @@ test true = "$rebase" && {
>>  			die "$(gettext "updating an unborn branch with changes added to the index")"
>>  		fi
>>  	else
>> +		test true = "$autostash" ||
>>  		require_clean_work_tree "pull with rebase" "Please commit or stash them."
>
> Trivial, indeed!
>
> It would be nice to have an --autostash command-line option too, and the
> error message in "require_clean_work_tree" could suggest using it. That
> would make the feature easily discoverable.

I would actually suggest doing this the other way around. --autostash option, followed by configuration if needed.

I actually have this slight suspicion that rebase.autostash and pull.autostash may want to be separate variables. Attempting to rebase locally when your working tree is in half-baked state is bad enough but may be warranted in some workflows, but doing so when integrating with other people's work is a practice in a different league. It would be quite sensible for somebody to want to allow the former (i.e. allows autostash with rebase.autostash=true for local rebase) while retaining the safety of the latter (i.e. stop pulling with pull.autostash=false).

Show 6 quoted lines
> Perhaps this patch could mention "pull --rebase" in the doc, like (config.txt)
>
> - 	ends.  This means that you can run rebase on a dirty worktree.
> + 	ends.  This means that you can run rebase or `git pull --rebase` on a dirty worktree.
>
> (or perhaps it's obvious enough and not needed)
Previous: Phil HordNext: Phil Hord
Message 6 of 14 in “Rebasing pull with autostash”
  1. 0/2 Rebasing pull with autostashRamkumar Ramachandra, Jun 14, 2013
  2. 1/2 pull: respect rebase.autostashRamkumar Ramachandra, Jun 14, 2013
  3. Matthieu MoyJun 14, 2013
  4. Ramkumar RamachandraJun 14, 2013
  5. Phil HordJun 14, 2013
  6. Junio C HamanoJun 14, 2013
  7. Phil HordJun 14, 2013
  8. Phil HordJun 14, 2013
  9. John KeepingJun 14, 2013
  10. Phil HordJun 14, 2013
  11. Ramkumar RamachandraJun 14, 2013
  12. 2/2 pull: clarify the large && { ... } formRamkumar Ramachandra, Jun 14, 2013
  13. Matthieu MoyJun 14, 2013
  14. Ramkumar RamachandraJun 14, 2013

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.