Git没有显示我有多少提交来源,我想要 [英] Git doesn't show how many commits ahead of origin I am, and I want it to

查看:88
本文介绍了Git没有显示我有多少提交来源,我想要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里有很多关于Git的问题,他们说人们在X提交之前领先于远程分支,他们希望它停止。



我有相反的问题。我希望Git告诉我有多少次提交,但不是。



当我首先创建我的远程裸仓库时,然后克隆它,这工作。在我目前的情况下,我首先创建了本地存储库,然后将其克隆(裸)到远程。



这将我的本地存储库设置为裸存储库的远程存储库。但我删除了它,并手动将远程存储库引用添加到本地。推进工作正常。但是我没有看到你提前通过X提交的消息。如何获取它?

解决方案

git branch --set-upstream local origin / remote



local remote >是你本地的名字。远程分支机构。



在Git 1.8及更高版本中,它更容易。确保你在本地分支,然后:

git branch --set-upstream-to origin / remote


There are plenty of questions here about Git saying people are ahead of a remote branch by X commits, and they want it to stop.

I have the opposite problem. I want Git to tell me how many commits ahead I am, but it doesn't.

When I created my remote bare repository first, then cloned from it, this worked. In my current case I created the local repository first, then cloned it (bare) to the remote.

This set up my local repository as the remote for the bare repository. But I removed that, and manually added the remote repository reference to my local. Pushing works fine. But I don't see the "You are ahead by X commits" message. How can I get it?

解决方案

git branch --set-upstream local origin/remote

local and remote are the names of your local resp. remote branches.

In Git version 1.8 and later, it's even easier. Make sure you're on the local branch, and then:

git branch --set-upstream-to origin/remote

这篇关于Git没有显示我有多少提交来源,我想要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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