Git with centralized workflow

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?

  • How to read the “Git Build Data” in Jenkins?
  • How to create file execute mode permissions in Git on Windows?
  • How to print all TODO comments I ever added or edited during any git commit
  • ls-remote --heads origin vs ls-remote . “refs/remotes/*”
  • PHP MySQL 5.5 db connection in Openshift
  • Does increasing the number of unified diff context lines have any downsides?
  • Import repository from git to gerrit
  • What's the best practice with git for multiple language implementations?
  • How specify new path for git hooks directory?
  • How can I clone from a git repository from 1 machine to another?
  • How to get the hash of the commit in which a deleted line was added?
  • Failure build on Maven release plugin
  • 3 Solutions collect form web for “Git with centralized workflow”

    git pull will fetch any changes made in the remote repository into yours, equivalent to svn update. However, it will not mention if there are changes made at your end that are not on the remote. You can also do git fetch to fetch updates from the remote without applying them to your workspace.

    With recent versions of git (e.g. 1.7.2.3 here) git status will print some information to help you see this, e.g.:

    # On branch master
    # Your branch is behind 'origin/master' by 20 commits, and can be fast-forwarded.
    

    This is showing after I did a git fetch and means there are changes waiting to go into my workspace (applied by doing git pull)

    By contrast, if I pull those in and make and commit a change locally, git status tells me:

    # On branch master
    # Your branch is ahead of 'origin/master' by 1 commit.
    

    That is, I have local changes that can be pushed to the remote. I could then list them by doing git log origin/master..

    The “git pull” command just pulls in the changes from the remote repo and merges them into your local branch.

    If you want to see the difference, you should use git br -a to list the remote branches, and then git diff the remote branch that your local branch is tracking.

    Just use git fetch to update your remote branches in your local repository. The dialog will show you if there was something downloaded, which you then compare using git diff or git log.

    Git Baby is a git and github fan, let's start git clone.