git - 在 Git 上 merge 分支时如何防止删除的文件返回

标签 git

我有分支“develop_refactor”,基于“develop”分支。在“develop_refactor”中,我删除了“develop_refactor”中的一些文件。有时,我从“develop” merge 到“develop_refactor”以更新来自“develop”的最新代码。但是删除的文件又回来了。我必须再次删除。我怎样才能防止它返回?

更新:

enter image description here

最佳答案

因此,保持分支更新的正确方法是通过 rebase 。

$ git rebase develop

这将在 develop 的最新提交之上重播所有 develop_refactor 的提交 - 从而确保每次都删除该文件。

关于git - 在 Git 上 merge 分支时如何防止删除的文件返回,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27736872/

相关文章:

linux - 如何在 Linux shell 脚本中自动填充请求的用户名?

linux - 文件所有权不会停留在 git 分支更改上

git - 将 Github 存储库链接到 Bamboo 时遇到问题

svn - RW 使用 svn (git-svnserver) 访问 git 存储库?

windows - Git bash 不断自动滚动到窗口底部

基于SVN从GitHub上的仓库git checkout到已有的本地仓库

git - 在 git 中,为什么要在一个分支而不是主分支上工作?

git - 删除推送到远程分支的 git commit

Git父分支正在获取子分支的更改

git - Intellij - 无法运行 Git