如何使用AndroidStudio中的特定软件包和文件禁用Git-Commit?

发布于 2025-02-11 00:16:53 字数 601 浏览 0 评论 0 原文

构建项目后,我有很多由Android Studio自动化的文件

,因此,当我尝试 commit 项目该项目时,提交部分已满,我不想>提交推向回购。

我怎么能告诉 git 不关心这些文件,也不提交或推出它们?

是什么

我尝试的 在 .gitignor 文件中添加dir dir,但似乎什么也没有发生。

The Problem

I had a lot of files autogenerated by Android studio after I build the project, so when I try to commit the project, the commit section is full of files I didn't want to commit or push to the repo.

enter image description here

How I can tell Git to don't care about these files and didn't commit or push them?

What I try

I try to add the packages dir in the .gitignor file, but it seems nothing happens.

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋凉 2025-02-18 00:16:53

虽然 git rm -cached -r- *.dex 就足够了,但不要忘记它只会从当前提交中删除这些文件。

如果它们很大,并且永远不应该犯下,则需要将它们从提交的完整历史中删除(假设您是唯一一个在此存储库上工作的人,或者假设您可以

使用 git push -force ) -filter-repo“ rel =“ nofollow noreferrer”> newren/git-filter-repo

cd repo
git filter-repo --path-glob '*.dex' --invert-paths

再次,如果这些文件很小,并且具有有限的历史记录,则简单 git RM - cached 就足够了。

While a git rm --cached -r -- *.dex should be enough, don't forget it will only delete those files from the current commit.

If they are big, and should never have been committed, you would need to remove them from the full history of commits (assuming you are the only one working on this repository, or assuming you can warn your colleague about the impending git push --force)

Using newren/git-filter-repo

cd repo
git filter-repo --path-glob '*.dex' --invert-paths

Again, if those files are small, and with a limited history, a simple git rm --cached is enough.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文