git - 合并两个分支,而目标分支从源分支中保留一个文件
问题描述
我有两个分支,其中一个具有特定文件,我不想在合并期间转到目标分支。我将文件的路径放在目标分支的 .gitignore 文件中,但是在合并过程中,文件来到了它。
这与任何本地计算机无关。这完全在 bitbucket 中作为远程存储库。一个合并到目标分支的分支有一个文件,该文件位于目标分支的 gitignore 列表中。
发生合并时,bitbucket 的目标分支是否会查看 gitignore?
如果是,为什么将文件复制到其中?
解决方案
To take effect of the .gitignore file you must update the index after making changes to .gitignore file
git rm --cached . #removes indexed files
git add . # adds back to the index while respecting .gitignore file
then make a commit and push it to the remote branch
推荐阅读
- macos - 将 QueryInterface 从 stdcall 更改为 register
- r - 在 macOS Catalina 上安装 RcppArmadillo 时出错
- python - pymodbus:更新运行服务器的上下文
- c++ - 定义易于维护的函数入口退出记录器时如何避免使用宏
- html - 为什么按钮不显示回来?
- excel - 通过 vba 从网站下拉列表中选择值
- javascript - 上传按钮 C# 在上传文件之前检查 MD5 哈希
- c++ - libuv - 空闲的写缓冲区
- html - 无法使用 CSS 创建页脚
- python - AutoML Vision Edge 中的 saved_model 未正确加载