Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm not sure I'm fully understanding when to fork a github project. I am about to add a big segment to my project and am wondering if I'm supposed to just commit the changes or is this a good time to fork?

According to their help pages a fork is used mainly if a visitor wanted to edit the project's code. But if I need to trash the new addition(s) and go back to the current setup is there a preferred option here between a commit and fork?

Thanks,

~Mike
Posted

1 solution

You don't need to fork. I suggest using a different branch here. On this branch, you can add the new segment and when you think it is ready, merge that branch with your master branch. I don't think committing is a good idea here. If you use commits on your master branch and make some mistakes on your new segment, you might need to reverse some commits which might be difficult if you also commit other changes on your master branch. If you use a different branch and make a mistake, you just need to revert a commit on that branch and not on your master branch. And when the segment is finished, merge the new branch with your master branch.

Some information about using branches and merging:
http://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging[^]
 
Share this answer
 
Comments
mswhat 4-Nov-14 14:45pm    
Thank you...I didn't think about branching but that makes sense. I can keep my current progress intact and then merge the new stuff once I'm sure the whole thing is going to be ok.

~Mike

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900