I’d like to use git branches to separate my local changes from the team’s head code, which is stored in a Perforce repository.
Perforce uses the read-only flag on unchanged files, and won’t update modified files if the read-only flag is not set, thinking that I might have changed them without putting them into a changelist.
I’d like to keep everything read-only on the master branch and modify files on other branches. Is it possible to make msysgit restore the read-only flag on the reverted files when checking out the master branch, so that p4 can sync everything?
You could write a git post-checkout hook with a bash script that sets the read-only flag…
Something along the lines of:
It looks like
./*skips the.gitfolder (hidden files/folders in general?), but you should check that out to be sure. You probably also want to use the full path to your git repo instead of just./*so that it doesn’t matter which dir/subdir you’re in…