1

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?

Ameen
  • 1,391
  • 2
  • 12
  • 26

1 Answers1

1

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"

http://git-scm.com/figures/18333fig0322-tn.png

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.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283