Using Git how do I find changes between local and remote

前端 未结 11 1299
感情败类
感情败类 2020-11-29 15:16

Here are two different questions but I think they are related.

  1. When using Git, how do I find which changes I have committed locally, but haven\'t yet pushed

11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-29 15:39

    Git can't send that kind of information over the network, like Hg can. But you can run git fetch (which is more like hg pull than hg fetch) to fetch new commits from your remote servers.

    So, if you have a branch called master and a remote called origin, after running git fetch, you should also have a branch called origin/master. You can then get the git log of all commits that master needs to be a superset of origin/master by doing git log master..origin/master. Invert those two to get the opposite.

    A friend of mine, David Dollar, has created a couple of git shell scripts to simulate hg incoming/outgoing. You can find them at http://github.com/ddollar/git-utils.

提交回复
热议问题