Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github showing (develop) branch behind master by x commits

Tags:

People also ask

Why is my branch behind Master?

The 4 commits behind master just means that your branch is out of sync with the master, and you should do a merge from master to your branch in order to get the latest changes from master into your branch.


I have been searching for the answer to this problem but have not found a solution or explanation.

We just switched to Github for our repo and are still trying to find the best way to use it in a team environment. Our current workflow is like this:

We have two branches develop and master

  1. Developer clones develop branch onto their machine and creates a branch using: git clone https://github.com/username/repo

  2. Developer creates the branch for the feature they are working on using: git checkout -b branchname

  3. Developer finishes branch and pushes to Github using: git pull then git push -u origin branchname

  4. Developer creates pull request and the lead developer will first merge the just pushed branch into develop and then merges develop into master

Now the thing that concerns me and makes me wonder if we are doing something wrong is that when we look at the master branch in Github everything appears fine, but when we view the develop branch inside of Github it says This branch is x commits behind master. Everytime we merge a pull request the number x goes up. Github gives the option on the same line to "Compare" or create a "Pull Request" but when I click either of those options it shows the branches are identical.

I have tried to fixed this previously by merging master into develop which does make the branches both even but as soon as a pull request is merged we get the same problem again.

When we first switched to Github I don't ever recall seeing that develop was behind master but our workflow has not changed. I don't know if maybe I just didn't notice it before or not.

If I compare the commits between the branches I can see that in fact develop is behind master by x number of commits. The commits that are showing up are the ones where I merge develop into master. What I am wondering is if it is something to be concerned about? The branches are identical besides the number of commits. Are we not using Git/Github correctly and is that why we are getting this, or is this a normal thing?