Subject: Re: [PATCH v4 0/5] Advice on checkout dirty files

From: Junio C Hamano <[email-masked]>
Date: Wed, 11 Mar 2026 09:38:47 -0700

"Arsh Srivastava via GitGitGadget" <[email-masked]> writes:

> This is my submission for microproject [GSOC]
>
> This patch adds a new advice type ADVICE_STASH_BEFORE_CHECKOUT to help users
> when they attempt to switch branches with local modifications that would be
> overwritten by the operation.
>
> The new advice follows the same patterns established by existing advice
> functions such as advise_on_updating_sparse_paths(). When triggered, it
> lists the affected files and suggests using git stash push/pop to save and
> restore local changes.
>
> The advice can be silenced with:
>
> git config set advice.stashBeforeCheckout false
>
> Changes:
>
>> advice.h: add ADVICE_STASH_BEFORE_CHECKOUT enum value advice.c: add
>> "stashBeforeCheckout" to advice_setting[] and implement
>> advise_on_checkout_dirty_files() function
>> Documentation/config/advice.adoc: document the new advice key
>
> Signed-off-by: Arsh Srivastava [email-masked]

Even though no developer is perfect, when you are presenting your
updated work, armed with wisdom borrowed from your reviewers'
comments on your earlier attempts, you are expected to take the
opportunity to pretend to have written a series of patches that are
perfect logical progression towards the final shape of the code
without detours, change of plans, and fixing earlier mistakes made
in the series.

Please do not throw a drunken-man's-walk series at us.  For example,
I see that [PATCH 3/5] literally removes what was added by earlier
patches.  This is not a place for you to show how you made wrong
turns before arriving at the final shape of the code.

The final series accepted by the project will have to stay in our
history for later developers to see in "git log" output to learn
from, and a series being clean logical progression is a must for
that to happen.

Also, what is "updation"?  Is it a standard English word, or some
dialect of an LLM origin?

> Arsh Srivastava (5):
>   advice: add stashBeforeCheckout advice for dirty branch switches
>   advice: add stashBeforeCheckout advice for dirty branch switches
>     [GSOC]
>   unpack-trees: suggesting 'git checkout -m <branch>' with its
>     repercussions
>   Updating tests and unpack-tress.c [GSOC]
>   File updation [GSOC]
>
>  t/t6439-merge-co-error-msgs.sh | 6 ++++++
>  t/t7406-submodule-update.sh    | 3 +++
>  unpack-trees.c                 | 9 +++++++--
>  3 files changed, 16 insertions(+), 2 deletions(-)
>
>
> base-commit: d181b9354cf85b44455ce3ca9e6af0b9559e0ae2
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2233%2FArsh123344423%2Fadvice_on_checkout_dirty_files-v4
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2233/Arsh123344423/advice_on_checkout_dirty_files-v4
> Pull-Request: https://github.com/git/git/pull/2233
>
> Range-diff vs v3:
>
>  1:  eb5639dbc3 = 1:  eb5639dbc3 advice: add stashBeforeCheckout advice for dirty branch switches
>  2:  e88c851701 = 2:  e88c851701 advice: add stashBeforeCheckout advice for dirty branch switches [GSOC]
>  -:  ---------- > 3:  4237b9667d unpack-trees: suggesting 'git checkout -m <branch>' with its repercussions
>  -:  ---------- > 4:  b25ea22410 Updating tests and unpack-tress.c [GSOC]
>  -:  ---------- > 5:  2ef7d5a3d6 File updation [GSOC]