#!/bin/sh # SPDX-License-Identifier: MIT set -eu export TZ=UTC LC_ALL=C export GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null export GIT_AUTHOR_NAME='Example Author' GIT_AUTHOR_EMAIL='author@example.invalid' export GIT_COMMITTER_NAME='Example Author' GIT_COMMITTER_EMAIL='author@example.invalid' export GIT_AUTHOR_DATE='2026-10-27T12:00:00+00:00' export GIT_COMMITTER_DATE='2026-10-27T12:00:00+00:00' test "$(git --version)" = 'git version 2.56.0' mkdir example-work cd example-work git init --bare -q --template= --initial-branch=main remote.git git init -q --template= --initial-branch=main project cd project git config commit.gpgsign false git config core.autocrlf false git remote add origin ../remote.git printf 'base\n' > tracked.txt printf '*.log\n' > .gitignore git add tracked.txt .gitignore git commit -qm 'Base files' git push -q -u origin main printf 'changed\n' >> tracked.txt printf 'draft\n' > scratch.txt printf 'secret\n' > private.log git stash push -q -u -m 'include untracked' test ! -e scratch.txt test -f private.log printf 'After -u: scratch saved; ignored log remains\n' git stash pop -q test -f scratch.txt git stash push -q -a -m 'include ignored' test ! -e scratch.txt test ! -e private.log printf 'After -a: scratch and ignored log saved\n' git stash pop -q test -f scratch.txt && test -f private.log printf 'After pop: both files restored\n'