简体   繁体   中英

Github showing (develop) branch behind master by x commits

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?

Your master branch is your base branch. You should only merge develop into master when you're absolutely sure everything works.

This branch is x commits behind master is just an information message that you don't need to worry about. Your only worry is making sure that master is as it should be.

Once you're done with the project and merge everything into master , you can delete any branches you created in the process.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM