Re: [PATCH v2 1/2] pull --rebase: add --[no-]autostash flag
From: Matthieu Moy <hidden>
Date: 2016-06-15 23:08:31
Mehul Jain [off-list ref] writes:
If user uses "git pull --[no-]autostash" then two possible things can be done:
* Either "git pull" ignores "--[no-]autostash" and calls
underlying "git merge",
as merge stashes the untracked files by itself. Thus
ignoring --no-autostash
flag given by user.
* Or "git pull" dies with the following error:
"--[no-]autostash is only valid when --rebase is used.
Example: git pull --rebase --[no-]autostash"
I suggest that the latter option should be used in this case as user should know
that stashing is performed by "git merge" anywayNot exactly. "git merge" doesn't do a stash, but it accepts to run if local changes do not touch the same files as the merge. So, --autostash is usually not needed for merge. But I agree that erroring out is better. Silently accepting the option and doing nothing with it would be confusing for users. This would mean that "git pull --autostash" would work, but still sometimes show the error: error: Your local changes to the following files would be overwritten by merge: The situation is different for command-line options and for config variables: the config variable wasn't explicitly specified for each run of "git pull", hence it's acceptable to ignore its value when we have nothing to do with it. -- Matthieu Moy http://www-verimag.imag.fr/~moy/