简体   繁体   English

我们如何创建自上次部署以来已更改的文件列表? 使用Git

[英]How do we create a list of files which have changed since the last deployment? Using Git

We are using TFS to deploy PDF files from a Git repository. 我们正在使用TFS从Git存储库部署PDF文件。

Deployments are tied to a specific branch. 部署绑定到特定分支。

Every so often it is decided that the branch contains good enough files to deploy. 经常会决定分支包含足够好的文件来进行部署。

We only want to deploy the files which have changed since the last deploy, not the entire branch. 我们只想部署自上次部署以来已更改的文件,而不是整个分支。 It is huge and takes too long to deploy the whole thing. 这是巨大的,并且部署整个事情花费的时间太长。

How can we tag the branch in a certain way when deployments happen and then when the next deployment is desired, compare the current branch to the tag and then deploy only the changes / differences / deltas? 当部署发生时,然后当需要进行下一个部署时,我们如何以某种方式标记分支,将当前分支与标记进行比较,然后仅部署更改/差异/增量?

Just to emphasize, this branch only contains PDF files, not code. 为了强调,此分支仅包含PDF文件,而不包含代码。 It does not need to be compiled. 不需要编译。

TO CLARIFY: 澄清:

On the build server, we want to avoid having to clone the entire repository every time the deployment process runs. 在构建服务器上,我们希望避免每次部署过程运行时都必须克隆整个存储库。 Usually, the first step in the deploy is to clone the repository, but this is taking too long. 通常,部署的第一步是克隆存储库,但这花了太长时间。 Is there a way to only pull down the files which have been added or modified? 有没有一种方法只能下拉已添加或修改的文件? Sparse checkout perhaps? 稀疏的结帐?

All the answer is in your question: 所有答案都在您的问题中:

  1. each time you want to deploy, you create a tag: git tag XYZ ${COMMIT_TO_TAG} 每次您要部署时,都会创建一个标签: git tag XYZ ${COMMIT_TO_TAG}
  2. to compare with previous tag by listing just files: git diff --name-status ${PREVIOUS_TAG}..${TAG_TO_DEPLOY} 通过仅列出文件与以前的标记进行比较: git diff --name-status ${PREVIOUS_TAG}..${TAG_TO_DEPLOY}

To find the previous tag: 查找上一个标签:

  • before creating the current tag: git describe --first-parent --tags --abbrev=0 ${COMMIT_TO_TAG} 在创建当前标签之前: git describe --first-parent --tags --abbrev=0 ${COMMIT_TO_TAG}
  • after creating the current tag: git describe --first-parent --tags --abbrev=0 ${TAG_TO_DEPLOY}~1 创建当前标签后: git describe --first-parent --tags --abbrev=0 ${TAG_TO_DEPLOY}~1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我怎样才能获得自从我上次使用Git以来在远程服务器上更改的唯一文件列表 - How can I get JUST a unique list of files that changed on remote server since my last pull with Git 自上次使用git / gerrit在Jenkins / Hudson中生成以来,如何获取已更改文件的列表 - How to get list of changed files since last build in Jenkins/Hudson with git/gerrit git-如何列出自某个日期以来未更改的所有文件? - git - How to list all files that have not been changed since a certain date? 自从特定作者在git中创建分支以来,如何获取已更改和已添加文件的列表? - How do I get the list of changed and added files since the creation of a branch in git by a specific author? 如果存在合并,如何显示自上次提交以来已更改文件的列表? - How to show a list of changed files since last commit if there was a merge? 自从在git中创建分支以来如何获取已更改文件的列表 - How to get the list of changed files since the creation of a branch in git 如何查找自提交后哪些文件未更改? - How to find which files have not changed since commit? Git:获取自上次推送以来所有更改的文件 - Git: Get all changed files since the last push 如何判断自上次git pull以来远程存储库上的哪些文件发生了变化? - How to tell what files on remote repository changed since last git pull? 确定使用Ruby更改了哪些git文件? - Determine which git files have changed using Ruby?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM