Reputation: 1857
When I clone a repository from github or any other website
and type: git status
it checks the current branch for changes against origin remote and shows the message (before making any new commits) : Your branch is up-to-date with 'origin/master'.
But in repositories that I create it doesn't check for changes also I tried to add a remote with the same name origin
but this also did not work
I also looked at the documentation git help status
but there is no information about that.
so How I will make my repositories checks for changes against the origin remote whenever I use the command git status
?
Upvotes: 1
Views: 753
Reputation: 1323253
It displays that message because a clone creates a local branch master which automatically tracks the "remote tracking branch" origin/master.
You can see it with git branch -avvv
.
See "Git remote branches"
But when you create a repo, even when you add a remote named 'origin
', your local master branch doesn't track anything yet.
For that, you would need:
git remote add origin /url/to/upstream/repo
git fetch origin
git branch -u origin/master master
(See "Make an existing Git branch track a remote branch?")
Then git status
would display a status regarding your local branch vs. your remote tracking branch.
Upvotes: 1