[英]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? 如何处理编译过程中创建的所有文件?
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的一个过程是这样的:
add and commit all source to project (before anything was built) 添加并提交所有源项目(在构建任何内容之前)
cd project
git add .
git commit -m'initial import'
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
then I run the build. 然后我运行构建。
make
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.