gpt4 book ai didi

git - 如果我将一个文件添加到我的 git repo,然后在 gitignore 中添加一个模式,表明该文件将被忽略,会发生什么

转载 作者:太空狗 更新时间:2023-10-29 14:39:36 27 4
gpt4 key购买 nike

假设我的 repo 中有一个 android 项目,我添加了 apk 文件。稍后我添加一个 gitignore 让我们说 this one .这个apk文件以后会发生什么?该文件将在每次构建后不断更改,因此是否会被 git 检查?就我而言,我希望它继续跟踪此文件。

最佳答案

该文件将继续被跟踪。您可以通过尝试轻松找到它:

$ mkdir /tmp/test
$ cd /tmp/test
$ git init
$ touch foo
$ git add foo
$ echo "foo" > .gitignore
$ git add .gitignore
$ git commit -m "initial commit"
$ echo foo > foo

现在,git status 将显示 modified: foo,如果您 git add foo,尽管有 ,它仍将被暂存。 gitignore.

关于git - 如果我将一个文件添加到我的 git repo,然后在 gitignore 中添加一个模式,表明该文件将被忽略,会发生什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14293280/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com