Reputation: 2521
I'm going to be uploading several files to a community Git project, and I am only supposed to upload certain files without permission, then ask for permission to upload all the rest should I need to change them. So, I would like Git to just ignore all the directories I don't have permission to freely change, so I can freely upload what I want, and then should the need arise, upload the directories I've changed that I don't have permission to.
What would be the best way about doing this?
Upvotes: 1
Views: 89
Reputation: 1323175
If those directories (you don't have permission to change directly) are already versioned, I wouldn't recommend a .gitignore
solution as:
.gitignore
(which the remote repo doesn't want to change)git rm -r --cached /folders/you/dont/have/permission
), which in turn risk to be committed and push (the remote repo wants those folders!)It is best to apply a local solution (which doesn't risk to be pushed by mistake).
Before adding anything, do (for the folder you don't have permission) a:
git update-index --skip-worktree -- /folder
See "using git skip-worktree to disable file updates".
Your git status
, git add
and git commit
should ignore that already versioned folder, even if you have modified/added files in it.
You can reverse that local change with a:
git update-index --no-skip-worktree -- /folder
Upvotes: 2