Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git branch vs Git fork

Tags:

git

git-branch

I have a general doubt. Suppose there is a git repo with master branch as development branch and you want to make some changes without effecting master branch and then you want to merge it later. What is the better approach?

  1. Create new branch in same repo and then merge it to master.
  2. Create new repo by forking and then merge it to master.
like image 266
Utkarsh Srivastav Avatar asked Sep 24 '26 06:09

Utkarsh Srivastav


1 Answers

If you know for sure that you will end up merging with the master branch eventually and/or your change is relatively small (bug fixes, new features), then definitely make a new branch. Only make a fork if you are going to make vast changes that could potentially become a new project in itself. That's the rule of thumb that I follow (as it follows the basic project design meta of git), so I hope that helps.

like image 164
liamnickell Avatar answered Sep 27 '26 05:09

liamnickell