Avatar of Bruce Gust
Bruce Gust
Flag for United States of America asked on

What is "base-branch?"

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...

master branch
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 what changed...

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?


Avatar of undefined
Last Comment
Bruce Gust

8/22/2022 - Mon
Bruce Gust

Hey, folks!

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."

Sound right?
Bruce Gust


When you make a branch, you're "branching" off of whatever branch that's currently checked out.

So, if I've...

checked out "code-cleanup..."
I do a "pull" to ensure that I've got the newest and coolest from the "code-cleanup" branch that's sitting on the remote repository...
and then create a new branch called "bruce-activity-stream"...

I've just created a branch (bruce-activity-stream) based on the most recent edits to the "code-cleanup" branch on my remote repository.


Now, if while I'm working on "bruce-activity-stream," I become aware that some changes have been made to the "code-cleanup" branch on the remote repository, I can do a "rebase." At that point, the foundation upon which "bruce-activity-stream" is updated and I may have some conflicts that need to be remedied, but that's how "rebasing" works.

Julian Hansen

View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Bruce Gust

So your "base branch" is simply the "base" upon which you're building your edits, correct?

That makes sense.

Thanks, Julian!

BTW: Do you know anything about Docker? I'm floundering and I need to start coding. Here's where I'm at: https://www.experts-exchange.com/questions/29179431/Can-anybody-answer-these-questions-about-Dokcer.html#questionAdd 

As always, thank you...!
Your help has saved me hundreds of hours of internet surfing.
Julian Hansen

You are welcome.

I have played around with Docker but I am no expert yet - will have a look at the question.
Bruce Gust

Boys, I've been taking shots at this all morning and I'm still coming up short. I've punted Docker for now, I'm just trying to get the site to come up. I'm at https://www.experts-exchange.com/questions/29179443/Why-will-this-site-not-come-up.html Would love for y'all to take a look at it.