I’m new to git, and am using a centralized workflow, similar to svn. I’d like to periodically know what my status is compared to the central repo. For example, if I run the following commands…
$ git clone git@github.com:centralrepo/test.git
$ cd test; <make some changes inside test/>
$ git commit -a
$ git pull
…git pull says “already up-to-date”. Why doesn’t git pull report changes, and if that’s the correct behavior, is there a way to know my local is out of sync with the remote?
git pullwill fetch any changes made in the remote repository into yours, equivalent tosvn update. However, it will not mention if there are changes made at your end that are not on the remote. You can also dogit fetchto fetch updates from the remote without applying them to your workspace.With recent versions of git (e.g. 1.7.2.3 here)
git statuswill print some information to help you see this, e.g.:This is showing after I did a
git fetchand means there are changes waiting to go into my workspace (applied by doinggit pull)By contrast, if I pull those in and make and commit a change locally,
git statustells me:That is, I have local changes that can be pushed to the remote. I could then list them by doing
git log origin/master..