git equivalent of svn status -u

后端 未结 7 950
无人及你
无人及你 2020-12-08 02:11

What\'s the git equivalent of svn status -u or more verbose svn status --show-updates. The svn status --show-updates command shows th

7条回答
  •  既然无缘
    2020-12-08 02:34

    You can use git ls-remote to list the SHA of references in a remote repository; so, you can see if there are any changes by comparing the output of:

    $ git show-ref origin/master     # <-- Where this repo thinks "origin/master" is
    5bad423ae8d9055d989a66598d3c4473dbe97f8f refs/remotes/origin/master
    $ git ls-remote origin master    # <-- Where "origin" thinks "master" is
    060bbe2125ec5e236a6c6eaed2e715b0328a9106    refs/heads/master
    

    If they differ, then there are changes to fetch:

    $ git remote update
    Fetching origin
    ...
    From github.com:xxxx/yyyy
    5bad423..060bbe2  master     -> origin/master
    

提交回复
热议问题