【问题标题】:How can i select the comitted files in a post-receive hook in git?如何在 git 的 post-receive 挂钩中选择提交的文件?
【发布时间】:2018-06-18 09:10:02
【问题描述】:

我需要获取在 post-receive 挂钩中提交的文件名。

#!/bin/bash

while read oldrev newrev refname
do
   /* If updated-file == "myFile", then do a specific task */
done

如何获取更改文件的引用?

【问题讨论】:

    标签: git push githooks git-post-receive


    【解决方案1】:

    我找到了一个简单的解决方案来获取已更改文件的列表。

    git diff --name-only $oldrev $newrev
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-08-31
      • 2013-06-26
      • 2012-03-12
      • 1970-01-01
      • 2012-05-18
      • 1970-01-01
      • 2012-02-17
      • 2015-08-10
      相关资源
      最近更新 更多