Question

On GitHub if I want to contribute to another user's repo I clone it, make changes and submit a PR, at which point the owner can choose to merge or not. I am trying to figure out how to create a similar flow with a private Git server.

We have a Git repo at work that I do 90% of the work on, but occasionally my co-worker will make changes and for whatever reason he refuses to tell me when he does, which results in frustrating conflicts and lost time.

As far as I can tell from Googling, there can only be one user listed in git-config.. am I understanding this point correctly? How can I achieve a workflow as described in the first paragraph?

Was it helpful?

Solution

There can be only one user listed in the local git config. Correct. But this does not mean that you cannot have multiple repository owners. When you create a project in GitHub, GitLab or any other git repository, you can have multiple collaborators and also different roles for the project collaborators.

So for example, if you are loosing a lot of time to resolve the conflits and merge the code of your co-worker, then you can give him the rights so that he can also do this job.

For me personally, the best way is not to Clone a project, but rather, to force all the collaborators to Fork the project. In this way, they will first have to commit and merge the changes to their own Master first, before making a merge request to the Project Master. This flow is safer, and easier to control.

Either way, is a matter communication and you guys as a team need to talk and decide the best way to organize your flow of development.

I also recommend you to take a look at Gitflow, which is a great tool to collaborate as a team using Git.

https://www.atlassian.com/git/tutorials/comparing-workflows

Licensed under: CC-BY-SA with attribution
scroll top