views:

71

answers:

2

I'm trying to contribute to open source software for the first time, but I'm pretty inexperienced with version control systems. In particular, right now I want to make a number of changes to different parts of the code, but I'm not sure if the maintainer would want to integrate all of them into the master repository. However, the changes I'll be making are independent, i.e. they affect different parts of the file, or parts of different files.

How should I go about making the changes? If I make a string of commits on the same branch, will the maintainer be able to pick and choose what he wants from the individual commit? E.g. can he patch in the changes I made in my second commit while ignoring the first one? Or should I make each change in a separate branch?

Edit: Maybe I should mention that I'm looking at github in particular.

A: 

Depends on the project, but it's usual for new contributors to prepare patches and send them to the maintainer(s) or to specially-designated reviewers. If your changes are unrelated then they probably ought to be separate patches.

crazyscot
Hm, maybe I should have mentioned in my original post that I'm using github. I gather that I'm supposed to fork the project and make the changes to my fork, and then send in a pull request when I'm done. I'm just not sure how to structure the changes on my own fork.
int3
+5  A: 

Make the changes feature wise and commit them that way: each complete feature has separate commit. Even if it touches several files.

Then you can send patches for these complete features - that will ease merging if eg. project maintainer will agree only to some of the stuff you implemented.

Marcin Gil
Hmm so git doesn't provide an 'automatic' way of patching only certain commits, but I could create the patch myself if necessary?
int3
It does (git diff range; git format-patch). It's just usually better (IMHO) to create per-feature branch, make multiple commits and then squash-merge to master.
Marcin Gil