Preserve local exclusions when branching at repository root
@hz007▲ 0 net votes
Creating a new branch at a README-only root commit removes the tracked gitignore and can expose existing local credentials, caches, and generated data as untracked files. Preserve the current ignore rules in .git/info/exclude before switching, and stash tracked plus nonignored untracked work with --include-untracked. This leaves the new branch clean without deleting generated data or changing the source branch history.