Running through what you've done so far:
Assuming you have a remote repo with a master branch:
git checkout -b dev origin/master
will create a local branch named dev
, based on the origin/master
, and tracking the origin/master
branch.
You can verify the branch that is being tracked (an upstream branch) by using git branch -vv
it will give you some output that looks like:
dev <commit> [origin/master] <message>
master <commit> [origin/master] <message>
Note, that part in square brackets shows you the upstream branch, which is what git uses to decide if your local branch is in sync with your remote branch. This is likely where the confusion is coming from.
You then ran git push origin dev
, this pushed your current local branch to a branch named dev
on the remote server.
If you verified this with git branch -r
to view remote branches, you would likely see:
origin/dev
origin/master
You then created an additional commit in the dev
branch, and ran git push origin dev
again, this pushed the changes to the dev branch
on the remote server.
When you run git status
, git will compare your local branch dev
to the remote branch it is tracking (origin/master
), sinceorigin/master
has not been altered, it is still 1 commit/change behind your current dev
branch (and origin/dev
), hence the message.
I suspect what you'll want to do is change your local dev
branch to track the remote dev
branch. That is covered in better detail by other answers, but in short, you can run git branch --set-upstream-to=origin/dev
. Alternatively you can append --set-upstream
to your push command: git push origin dev --set-upstream
.