DEV Community

loading...

Discussion on: How to use git efficiently

Collapse
agevaled profile image
Pablo de la Vega

Yes, I know that, on the company I'm working I always recommend to fork the project and then work on the forked one, the devs don't have write access to the original repo, I like to keep clean the original repo and only have the branches I (or the Technical lead) want to keep.

For me the Pros i found:

  • Have clean original repo (few branch)
  • Each Branch belong to the developer how worked on that

Cons:

  • Extra steps to update your local code.
  • You can't prevent the dev work on master or developer branch.
    • Easy to brake the master/developer branch.

What do you think? you add more pros and cons?

Thanks for your time, regards.
-Pablo

Thread Thread
adityasridhar profile image
Aditya Sridhar Author

Thanks for mentioning them :)

You have pretty much covered the pros and cons. Here Will list out some more as well

Pros of forking:

The dev's do not need to worry much about breaking the code by mistake Since they wont have access to the original repo

cons

as you mentioned, it can be more time consuming to update local code

But I did come across branch level permissions as well. So one thing which can be done is only the tech lead and some senior devs have write access to the master and the release branch.

All the other developers will have complete access to feature branches, but a read only access to master and release branch. This will ensure the code in master branch and release branch are reviewed and tested code

What do you think about branch level permissions instead of forking in enterprise projects?

Open source I guess forking is the way to go, Since there will be an explosion of branches if every single open source developer gets their own branch in the original repo :D

Thread Thread
agevaled profile image
Pablo de la Vega

Agreed with you, I'm currently thinking on what is the best approach using fork or branch access on upstream.

As you say OS project is the way to go, but I'm thinking if we will use fork or branch, due the ore junior devs have a lot of issues when they need to update the code :/

Thanks,
-Pablo

Thread Thread
adityasridhar profile image
Aditya Sridhar Author

Either one should be fine :)

Use the method the team is more comfortable with :)