This is an automated archive made by the Lemmit Bot.

The original was posted on /r/opensource by /u/HittingSmoke on 2024-12-06 20:04:48+00:00.


I’ve been programming and using git for quite a while. I’ve never had to collaborate so my git workflow has so far been a single master branch that I commit features to as I go and push to my remotes. I’ve rarely had to actually use it for any serious purposes and it mostly serves to sync my code between my workstation and laptop.

I’ve been starting to contribute to a few open source projects on Github. It’s made me realize that I don’t really understand the best way to collaborate using git. Nobody has said anything to me about it, but my commits look messy in my opinion.

Example: I’m programming three separate features/fixes. They’re all going to get their own commit. I would like them all to be individual pull requests as they each warrant their own isolated discussion. If I just make the three commits to the same branch, they all get lumped into a single PR.

Do I make a new branch for each feature, submit the PRs from the branches, then merge them all back into my master branch to continue my work? How do I ensure that I can submit my PRs as a clean, single commit without a lot of noise from my trying to keep my local code up to date?

What if I have a couple of features that should be PR’d separately, but the way I’m testing them locally requires them both to be implemented in my local code together? Would I merge them for testing, do my testing, then delete the merged branch and commit before submitting my PRs using the individual branches?

I guess I’m just looking for best practices so I don’t end up annoying the people maintaining the projects I’m trying to contribute code to.