Is there a way to lock individual files or directories on fork when using github?
We are a team of 60+ developers working on the same product and are moving from SVN to Github. We have a process in SVN where in individual files are locked and whenever a developer wants to commit code, he needs to get it unlocked by the owner of the file. Three of us are the owners of the total 150+ files. The unlocking is preceded by a code review.
In Github, we are planning to use the Fork-Clone model – each project a group of dev is working on will do a fork, each developer will do a clone of the fork, write the code & commit to origin, the lead of the feature will do a pull request to upstream.
Though this seems fine, the problem is when a big project gets delivered, it brings in lots of changes for review and hence, increases the load for the file owners. Also, this might happen in the later cycles of development and hence the project might be jeopardized.
One method we thought might work is to have hooks when the git push is done to the origin (fork). There can be one final review git pull to upstream.
However, we could not find any github extensions or push hooks for the same. Is there a quick way (read, existing extension) to do this with Github or should we use the same hooks that we would use with git?
4 Solutions collect form web for “Is there a way to lock individual files or directories on fork when using github?”
This use case is one of the reasons Git is so much better than SVN –> rebase! If you follow good git workflow you rebase from upstream before submitting your Pull Requests. You don’t need to worry about file locking and stomping on another person’s commits and merge conflicts etc… a rebase sets your work aside, applies the remote commits and then applies your work on top.
I think this just takes a rethinking in your process and relying on the strengths of git versus force fitting a Subversion workflow on top of git. Your “fork-clone” model might need another look as well. Most often every developer has their own fork, you can share repos via remotes between teams if you want. But contributors sharing the same origin sets up some bad habits.
Gitflow is a very popular git workflow, and Github themselves has some nice tips and shares their workflow.
No chance, if file is not mergeable and you need to lock it, use a centralized solution instead of GIT, i.e. SVN or ClearCase.
There is no way of doing it in Git. As others said, if the document is “mergable”, you can try rebasing, changing the way you act.
In our case, we have a convention: if you REALLY need to lock it, rename it. But we only do such things in office documents, etc.
This constribution is not giving a solution, it is a workaround trick (but stackoverflow does not allow me to add this as a comment.
Git does not provide any locking functionality, since it is decentralized. However, if you host your code on GitLab Enterprise Edition Premium, you can use the web interface to lock individual files or folders, achieving exactly what you want to do.
If you do not want to host your project on someone else’s server (their website), you can also download GitLab and host it on your own webserver.