Git:处理 .class 文件和其他编译对象
假设我有几个具有不同代码的分支:BranchA 和 BranchB。假设我当前在 BranchA 上并运行构建。假设我的构建将 .class 文件和其他编译对象转储到工作树中的目录中。当我运行 diff 时,我看到目录已更改,因为其中包含新的编译对象。
如果我切换到 BranchB 并部署我的代码,那么我实际上是在部署从 BranchA 的代码库编译的对象,因为 git 跨分支切换维护了我的浮动更改(新编译的对象)。这显然是一个错误。
有几种方法可以避免这种情况,一种是每当我们切换分支时清理非版本化文件,但是有没有一种更简单的方法来处理这个问题。我真的不想将编译的对象放入版本控制中。
Lets say I have a couple branches with different code: BranchA and BranchB. Assume I'm currently on BranchA and run a build. Suppose that my build dumps .class files and other compiled objects into directories within the work tree. When I run a diff, I see that directories have changed because they have new compiled objects within.
If I switch to BranchB and deploy my code, then I'm actually deploying objects compiled from BranchA's code base, since git maintained my floating changes (new compiled objects) across the branch switch. This is obviously a mistake.
There are a few ways to avoid this, one being cleaning up non-versioned files whenever we switch branches, but is there a more fool-proof way of taking care of this issue. I'd really rather not put compiled object into version control.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我所做的
What I do