From: Arsh Srivastava via GitGitGadget Date: Tue, 10 Mar 2026 08:51:13 GMT Subject: [PATCH 0/5] Advice on checkout dirty files Message-ID: 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 arshsrivastava00@gmail.com Arsh Srivastava (1): advice: add stashBeforeCheckout advice for dirty branch switches Junio C Hamano (1): The 13th batch K Jayatheerth (1): repo: remove unnecessary variable shadow LorenzoPegorari (2): diff: handle ANSI escape codes in prefix when calculating diffstat width t4052: test for diffstat width when prefix contains ANSI escape codes Documentation/RelNotes/2.54.0.adoc | 14 +++++++++++++ Documentation/config/advice.adoc | 5 +++++ advice.c | 27 +++++++++++++++++++++++++ advice.h | 2 ++ builtin/repo.c | 1 - diff.c | 12 ++++------- t/t4052-stat-output.sh | 32 ++++++++++++++++++++++++++++++ 7 files changed, 84 insertions(+), 9 deletions(-) base-commit: 3fe08b8fd1f7731edabeab8138547ec88d6407de Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2233%2FArsh123344423%2Fadvice_on_checkout_dirty_files-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2233/Arsh123344423/advice_on_checkout_dirty_files-v1 Pull-Request: https://github.com/git/git/pull/2233 -- gitgitgadget