- 2,186
- 2,694
- TL;DR
- How can I set up tracking such that Git can inform me when my local repo is behind the remote?
I have a local repository (let's call it
Now I create another branch in my local repo, add a file in that branch, commit the change and merge the branch with master:
If I execute git status on
This is expected. So I push the commit using
and I can see my commit on Github.
Now, I go to Github, select the master branch, add a file (
However, if I execute
How can I set up tracking such that Git can inform me when my local repo is behind the remote (i.e. when
MyRepo) that is linked with Github (origin). The master branch is set to track origin/master using
Bash:
$ git branch -u origin/master
Now I create another branch in my local repo, add a file in that branch, commit the change and merge the branch with master:
Bash:
$ git checkout -b side
$ touch some.txt
$ git add .
$ git commit -m "Added some.txt"
$ git checkout master
$ git merge side
master, I get the following:
Bash:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
Bash:
$ git push -u origin master
Now, I go to Github, select the master branch, add a file (
some2.txt) and commit the change. I expect Git to tell me that my local repo is behind origin/master by one commit. But this never happens:
Bash:
$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
git pull on the master branch, the changes in Github appear immediately in my local repo.How can I set up tracking such that Git can inform me when my local repo is behind the remote (i.e. when
master is behind origin/master)?