Re: Pushing into a repository with working directory?
From: Andy Whitcroft <hidden>
Date: 2016-06-15 22:42:47
Shawn O. Pearce wrote:
So tonight on #git I think I answered for the 10th time why the working directory doesn't update after a push to its associated repository. We all know its somewhat dangerous to push into the current branch of a working directory, especially if that working directory contains uncommitted changes, as HEAD no longer matches the index. But we all also know its incredibly useful to be able to push into a repository with a working directory, so we certainly don't want to disallow it entirely. What about refusing a push to the current branch (branch listed in $GIT_DIR/HEAD) and the repository appears to have a working directory (is_bare_git_dir is false)?
Special casing the 'current' branch makes any sort of automated push setup unreliable. Indeed the special case preventing a fetch into the current branch is pretty annoying for the same reason. I would almost prefer to relax that than add the same for push. -apw