Home > Net >  How to fix 'This branch is 1 commit behind master.'
How to fix 'This branch is 1 commit behind master.'

Time:09-24

I am trying to set up Github branches correctly and I notice that on GitHub, on my dev branch, it says This branch is 1 commit behind master..

I have already tried the other stackoverflow questions about this none worked for me.

In VS Code, I have checked out my dev branch and if I run git status, then it says

On branch dev
Your branch is up to date with 'origin/dev'.

nothing to commit, working tree clean

But GitHub console still tells me that This branch is 1 commit behind master.. I want the changes I have from dev to be uploaded to the master branch. The dev branch has everything I need, it is okay if it just overwrites the master branch.

I already tried doing this in my dev branch:

git add .
git commit -m "update"
git push origin dev

Please, what can I do? I have been stuck on this for hours!

CodePudding user response:

Try the following steps while you've got your dev branch checked out: git fetch origin, then git merge master.

This will bring any extra commits from master into your dev branch and may cause merge conflicts.

Resolve any merge conflicts and then run git push origin dev to push your updated and caught-up dev branch up to origin.

  • Related