简体   繁体   English

从PR删除文件

[英]Remove File From PR

I need to remove one file from PR that I have changed in few commits and pushed in my feature branch. 我需要从PR中删除一个文件,该文件在几次提交中已更改,并已推送到功能分支中。 I am trying the following : 我正在尝试以下方法:

In my PR branch in run the command : 在我的PR分支中运行命令:

git checkout origin/develop -- path/to/my/file

when I type git status , no change is shown. 当我输入git status ,没有显示更改。 Hence, not able to commit/push 因此,无法提交/推送

Next, when i compare my local file in feature branch with copy present in develop branch (using beyond compare) -> content are same/no diff 接下来,当我将功能分支中的本地文件与开发分支中的副本进行比较时(使用超越比较)->内容相同/无差异

But when I see my PR, I still can see changes in that file and that file present in PR. 但是,当我看到自己的PR时,仍然可以看到该文件中的更改以及PR中存在的文件。

It seems changes are not getting push/commit. 似乎更改没有得到推送/提交。

Any solution to solve this? 有解决方案吗?

Thanks, 谢谢,

That's not a direct answer, but I would try to simply restore the file from upstream and commit it in the PR branch, ie: 这不是直接的答案,但是我会尝试从上游简单地还原文件并在PR分支中提交它,即:

git show origin/master:path > path
git add path
git commit -m"restore [file]"

You can try doing the following: 您可以尝试执行以下操作:

  1. Delete the file from filesystem 从文件系统删除文件
  2. git add your-file or git add . git add your-filegit add .
  3. git commit -m "commit message"
  4. git push

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM