Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Andrew McCormick
Andrew McCormick
17,730 Points

Best practice for using Git with a team (specifically merging)

The quest for establishing a workflow continues...

We use BitBucket for our remote git repository. I say we, but really it's currently just me at the moment, since before I came along no one was using Version control.... gasp**

Another person in the company is about to move into our team and help me with some of the actual coding (the third guy on the team is more the DBA and lays out the software design, I just get to make it happen). So now we will have two people using the version control.

Currently I work on localhost. I have my local repository and push each night (or when I finish a big feature update) to the remote. I branch whenever I fix something, or begin working on a new feature. Pretty simple.
However if there is someone else now actively branching and working on the repository, how do I handle making sure he doesn't merge stuff into master (or another branch for that matter) that I don't think should be merged. Maybe it's not ready, maybe it's bad code, etc.

In my mind, he would push to the branch on the remote repository that he's working on, then send me a message that he's ready to have that branch merged into master (or whatever branch). I would then pull that branch down to my local repository, review it, and make the merge.

Does that sound about right?

** btw. I just read more on Pull Request. I completely forgot about this. (shouldn't it be called a Push request instead..lol). Is the answer to what I'm looking for?

2 Answers

Ricky Catron
Ricky Catron
13,023 Points

I would say the Pull Request would be your best solution. It is a pull request because instead of allowing them to push into your code they send you a message saying check this out and then maybe merge it. If you like it I think you pull the code in. It prevents them from making changes without authority.

Andrew McCormick
Andrew McCormick
17,730 Points

thanks! Now the name makes sense. I guess since I'm not use to working with a team, I'm not use to having to pull other people's code down yet.

Ricky Catron
Ricky Catron
13,023 Points

Glad to help. I have recently begun with Git myself and liked Bitbucket but switched to the larger community at Github. Git seems tricky at first but now the simple commands come easy. Merges and more complex features can still be difficult but it isn't scary once you dive right in.

James Barnett
James Barnett
39,199 Points

liked Bitbucket but switched to the larger community at Github

I use bitbucket for private projects and when I have something I want to show off to the world, I'm going to push it up to Github.

Andrew McCormick
Andrew McCormick
17,730 Points

that's where we are at. Everything we work on for clients is private repository. BItbucket has unlimited private repositories for up to 5 team members so it's perfect.
if we ever want to show our code to the world then might consider using Github.

Andrew McCormick
Andrew McCormick
17,730 Points

thanks. exactly the type of information I was looking for.