简体   繁体   English

使用版本控制编译工作流程

[英]Compiling workflow with version control

Up till now I've used version control for simple web-based projects that don't really have a compile stage. 到目前为止,我已经将版本控制用于基本的基于Web的项目,这些项目实际上没有编译阶段。 I've now forked a relatively large project that follows the standard "./configure; make; make install" pattern. 我现在分叉了一个相对较大的项目,该项目遵循标准的“./configure; make; make install”模式。 I'm unsure about the proper workflow for this type of project. 我不确定这类项目的正确工作流程。

What do I do with all the created files from the compile process? 如何处理编译过程中创建的所有文件?

  • Add lots of stuff to .gitignore? 添加很多东西给.gitignore? This is hard, because I did not create the build process and do not really understand everything that is created. 这很难,因为我没有创建构建过程,也没有真正理解所创建的所有内容。
  • Checkout the project somewhere else for each build? 在每个构建的其他地方签出项目? This seems like a pain, given that I often build every few minutes. 这似乎是一种痛苦,因为我经常每隔几分钟建立一次。
  • Just make sure never to add something I don't know about, ie never do git add . 只是确保永远不要添加我不知道的东西,即永远不要做git add . If so, how do I cleanup now and then? 如果是这样,我该如何清理呢?

Obviously this is something everybody who deals with compiled code faces, so I'm sure there's an accepted pattern, I just am not familiar with it yet. 显然这是每个处理已编译代码的人,所以我确信有一个可接受的模式,我还不熟悉它。

I agree with ChrisF, don't store binaries generated by the build in your repository. 我同意ChrisF,不要将构建生成的二进制文件存储在您的存储库中。 Your goal should be to have a nice .gitignore file, so that at any time running git status should show no "untracked files". 你的目标应该是拥有一个漂亮的.gitignore文件,以便在任何时候运行git status都不会显示“未跟踪的文件”。 That means git is either ignoring or tracking all files. 这意味着git要么忽略所有文件,要么跟踪所有文件。

One procedure I use to build my .gitignore is this: 我用来构建我的.gitignore的一个过程是这样的:

  1. add and commit all source to project (before anything was built) 添加并提交所有源项目(在构建任何内容之前)

    cd project

    git add .

    git commit -m'initial import'

  2. add simple patterns of files that will be ignored to .gitignore ; 添加将被忽略的简单文件模式.gitignore ; this includes tings like *.o, *.so. 这包括* .o,* .so等。

    echo '*.o' > .gitignore

    echo '*.so' >> .gitignore

  3. then I run the build. 然后我运行构建。

    make

  4. then I run 然后我跑了

    git ls-files -o >> .gitignore

    which will pick up any outstanding files that are generated which you didn't specify with glob patterns. 这将获取您未使用glob模式指定的任何未完成文件。

-Bart -Bart

To clean up your working directory, you can use git clean . 要清理工作目录,可以使用git clean It won't do any harm by default, unless you specify the -f (force) flag. 除非您指定-f (强制)标志,否则默认情况下不会造成任何伤害。

The command line git clean -xfd will delete everything in your working directory, that is not in version control. 命令行git clean -xfd将删除工作目录中的所有内容,而不是版本控制中的内容。

Simple strategy is to store make output in another directory, eg build and then ignore this directory. 简单的策略是将make输出存储在另一个目录中,例如build,然后忽略该目录。 You can configure it like this: 您可以像这样配置它:

mkdir build && cd build && ../configure

You shouldn't put intermediate or output files under source control. 您不应将中间或输出文件置于源代码管理之下。 If you did you'd have to check them out to make the files writeable every time you compiled and built the solution. 如果你这样做,你必须检查它们,以便在每次编译和构建解决方案时使文件可写。

You don't say what IDE (if any) you are using - check to see if it can add the project to source control for you. 您没有说出您正在使用的IDE(如果有) - 请检查它是否可以将项目添加到源代码管理中。 If it can then use this option as it will only add those files that are absolutely needed. 如果它可以使用此选项,因为它只会添加绝对需要的那些文件。

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

相关问题 版本控制工作流程建议 - Version Control Workflow Recommendation SAAS 工作流的版本控制 - Version Control for SAAS Workflow 适当的版本控制工作流程,可用于混合存储库 - Proper version control workflow for a mixture of repositories 具有多个服务器的远程站点中的开发和版本控制工作流 - Development and version control workflow in a remote site with several servers 分散式版本控制系统如何改善工作流程? - How does a decentralised version control system improve workflow? 硬件 (ECAD)、文档和固件项目的版本控制工作流/架构建议 - Version Control Workflow / Architecture recommendations for Hardware(ECAD), Documentation, and Firmware projects git工作流:我可以阻止某个文件合并到另一个分支但仍保持在版本控制之下吗? - git workflow: Can I prevent a certain file from being merged to another branch but still keep it under version control? 具有版本控制功能的WordPress开发工作流程 - WordPress development workflow with version controlling 使用集中式工作流程进行Git版本编号 - Git Version numbering with a centralized workflow 是否可以通过高级访问控制来实现GIT工作流程? - Is it possbile to achive GIT Workflow with advanced access control?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM