git diff在裸露的回购 [英] git diff on a bare repo

查看:102
本文介绍了git diff在裸露的回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  cd / path / to / my上一个月, /bare/repo.git/ 
git --git-dir。 diff --shortstat@ {1 month ago}
致命:无法读取日志'logs / refs / heads / master':没有这样的文件或目录

然而,它在本地checkout-ed工作分支中工作正常。



有没有办法做到这一点没有太多的麻烦?

为了避免XY问题:我想通过数百个在Gitlab服务器上的回购数据来运行统计数据

尝试并确保在裸回购中区分时指定两个提交(或diff将默认为工作树,而不存在于 裸露的回购 )。



t需要 - git-dir。



但是,当使用日期 href =http://git-scm.com/docs/git-rev-parse#_specifying_revisions =nofollow noreferrer>指定版本不会起作用,因为它基于 logs / refs ,这在a中不存在裸露的回购

 < refname> @ {< date>} master @ {yesterday},HEAD @ {5分钟前} 




A ref后跟后缀@,并在括号内包含一个日期说明(例如 {昨天} {1个月2周3天1小时1第二个前面} {1979-02-26 18:30:00} )指定先前时间点ref的值。

此后缀只能在ref名称后面立即使用,并且ref必须有一个现有日志( $ GIT_DIR / logs / 即可。



I wanna see how much a repo changed in the last month on gitlab server side

cd /path/to/my/bare/repo.git/
git --git-dir . diff --shortstat "@{1 month ago}"
fatal: Unable to read log 'logs/refs/heads/master': No such file or directory

However it works fine in local checkout-ed working branch.

Is there a way to do this without too much hassle?

To avoid X-Y problem: I wanna run statistics through hundreds of repos on a Gitlab server

解决方案

Try and make sure, when diff'ing in a bare repo, to specify two commits (or diff would default to the working tree, which doesn't exist in a bare repo).

You don't need --git-dir .

However, using date when specifying a revision wouldn't work, as it is based on logs/refs, which doesn't exist in a bare repo

<refname>@{<date>}, e.g. master@{yesterday}, HEAD@{5 minutes ago}

A ref followed by the suffix @ with a date specification enclosed in a brace pair (e.g. {yesterday}, {1 month 2 weeks 3 days 1 hour 1 second ago} or {1979-02-26 18:30:00}) specifies the value of the ref at a prior point in time.
This suffix may only be used immediately following a ref name and the ref must have an existing log ($GIT_DIR/logs/<ref>).

这篇关于git diff在裸露的回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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