1

I have created a repo on Github and added a contributor to work with me on the project. I'm a little confused as to how to instruct them to work on the project

Some docs are saying they should fork the project to their own account and then clone locally

Other are saying create branches of the master

Im new to git and he is.. but i have working knowledge of CVS and SVN im confused as to instruct him the best way to checkout my master and work on it

So should I tell him to fork and clone.. or If i tell him to branch.. does he need to do an initial checkout of the master first?

Just trying to clear this up..

Oh.. also question for my own sanity.. I should be working off a branch off my own master.. and how does that effect the local files when I switch through branches

Machavity
  • 30,841
  • 27
  • 92
  • 100
  • See also http://stackoverflow.com/questions/3611256/forking-vs-branching-in-github/3611349#3611349 – VonC Jan 04 '14 at 07:43

1 Answers1

1

Whether to fork your repo or just clone and branch depends on your workflow. If you want to manage your project like a centralized system, then simply have him clone your repo locally on his machine using:

git clone https://github.com/username/your-project.git

Then he can make a branch and request that you pull from his clone. If you want to try the distributed method of source control management, then have him fork your repo. Then he can clone, make changes, push to his fork, and then send you a pull request right on github. I recommend forking because pulling from another machine seems a little more complicated and because github has some very nice features for displaying the changes that have been made. No matter which way you do it, I would recommend branching, making your changes and then merging back to master (you can see the reasoning in the answer to this question).

Oh.. also question for my own sanity.. I should be working off a branch off my own master.. and how does that effect the local files when I switch through branches

When you switch branches, git removes all your previous branch's commits and changes from files and then adds all commits and changes to files from your new branch. Also I recommend checking out the git documentation. It should be able to answer basic questions about how git works and how you can get started using it.

Community
  • 1
  • 1
stiemannkj1
  • 4,418
  • 3
  • 25
  • 45
  • Thanks for the great explanation. Im using the github app.. so when i switch between branches on my machine it actually does a checkout? What your saying if i understand correctly is - I have a main branch.. i just made a new unpublished branch - so I would do my changes to the code.. commit - then i can merge to the master. After that would I then make a new branch? Thanks! – Ricky Mataka Jan 04 '14 at 06:08
  • I don't know about the github app, but I would assume it does a checkout when you switch branches. My usual workflow with respect to branching is this: create a new branch from master, do my work and commit, merge the changes to master, and delete my old branch. If I have another project to do, I create a new branch and start the process all over again. Your workflow could differ, but that's how I generally do it. That way you can test all your changes on your new branch, but anyone who downloads and tries master will be able to use it just fine because it is still stable. – stiemannkj1 Jan 04 '14 at 06:23