Recently I did a pull request and my team lead came back and said that it looked as though I had based my branch of "master" rather than "code-cleanup."
"master" is three months old. "code-cleanup" is the one that everyone on my team has been merging into.
Thankfully, I was able to verify that I had created my branch / most recent work off of "code-cleanup," but I couldn't understand why my team lead would've thought that my pull request was referring to a branch that was so obviously behind the eight ball.
Here's a few screenshots to give you a visual:
Here's "master." This is the original body of code that we all branched off of as part of our collective effort to clean things up...
Here's "code-cleanup." This is the branch that has all of our individual efforts represented in one "new" block of code...
This is the branch that I created off of "code-cleanup" that has my most recent changes...
When I made my pull request, this is how it looks - bear with me, because I think I see what
changed but I want to understand
When you double click on that pull request, you see this:
What I have in the "box" looks like some activity that was done on my behalf by a team member. He reassigned my base branch to "code-cleanup" as opposed to "master."
Without even know what that is, intuitively I can see something that explains why my team lead would've thought that I had based my changes off of "master."
But what happened when my associate changed my "base branch."
- What did that do?
- How was it done?
- Is it something I should've done myself?
- Should my team lead have been able to see what my associate noticed and changed?
- How do I prevent this from happening in the future?
I think I figured this out for myself. Let me explain it back to you and tell me if this isn't accurate:
"Base Branch" is nothing more than what you designate to be your "final product." More often than not, it's "master."That's the code that you'll typically move to production. When you look at github, you'll see a number displayed alongside the branch name which represents the number of commits that branch is ahead of your "base."
One thing you want to be sensitive to when you do a "pull request," is to ensure that your "base" is correct. In this particular scenario. "code cleanup" is the base branch, although there is a branch in the mix called "master." "master" is rightfully assumed to be the base, but that's not the case in this instance. When I did my pull request, I didn't make that change. Hence, my team lead, who probably didn't look at my branch (which is significantly different than "master"), but saw the "base" as master, just assumed that I had based my work off of master rather than "code sample."
So, "base branch" is not an especially technical concept. It's just your starting point that every other branch is going to be based on. If you establish another branch as the temporary "base," you need to make sure you're pulling from that branch when you get ready to do any new work and when you make your pull request, you want to select the correct branch you want to identify as your "base."