git diff on a bare repo

前端 未结 2 670
栀梦
栀梦 2021-02-10 04:27

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}\"
fa         


        
2条回答
  •  -上瘾入骨i
    2021-02-10 04:30

    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

    @{}, 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/).

提交回复
热议问题