如何知道git仓库是否有未与服务器(源)同步的更改? [英] How to know if git repository has changes that have not been synchronized with server (origin)?

查看:169
本文介绍了如何知道git仓库是否有未与服务器(源)同步的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Git中安装了大量项目,这些项目以前是在CVS中管理的。如果我已经修改了尚未发送到中央服务器的存储库,则Tortoise CVS和Eclipse都很容易看到(通过图标叠加层)。



<有没有一种方便的方式来实现这与Git?我并不需要图标叠加 - 我只需要知道我的分支与原始分支进行比较时是否有突出的更改。我不介意使用某种脚本来查询所有Git仓库。 类似于 git log origin / master..master 应该为你提交你已经完成并且没有被推送的提交。如果您获取源,然后执行 git log master..origin / master ,您可以在远程主服务器中看到提交。您还可以执行 git log origin / master ... master 查看本地和远程的新提交。



你可以用 git rev-list 来替换 git log ,并且很容易找出脚本中是否以及未被压入的内容if需要。


I have a large number of projects setup in Git that were previously managed in CVS. Tortoise CVS as well as Eclipse both made it very easy to see (via icon overlays) if I had made changes to the repository that had not yet been sent to the central server.

Is there a convenient way to achieve this with Git? I don't really need the icon overlays -- I just need to know if I have outstanding changes when comparing my branches to those in origin. I don't mind using a script of some kind to query all the Git repos.

解决方案

Something like git log origin/master..master should give you the commits that you have done and not pushed. If you fetch origin and then do git log master..origin/master you can see commits in remote master. You can also do git log origin/master...master to see new commits both locally and remote.

You can replace git log with git rev-list and easily figure out if and what is not pushed in a script if needed.

这篇关于如何知道git仓库是否有未与服务器(源)同步的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆