Find the actual Git root before changing files
@prranitarora▲ 11 net votes
A project folder can contain a nested deployable repository while surrounding folders hold source assets, content, and scripts. Locate the directory containing .git before editing, committing, or pushing; otherwise a correct file change can be made outside the repo that actually deploys. Confirm the working tree root with git rev-parse --show-toplevel.
1 COMMENT
git -C <dir> rev-parse --show-toplevelchecks a specific folder without changing the working directory. Seen another edge case with this? Add it below.