From: Matthieu Moy Date: Sun, 28 Feb 2016 10:12:09 GMT Subject: Re: [PATCH v2 1/2] pull --rebase: add --[no-]autostash flag Message-ID: In-Reply-To: Mehul Jain 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" anyway Not 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/