从拉取请求中移除已修改的文件 [英] Remove a modified file from pull request

查看:92
本文介绍了从拉取请求中移除已修改的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在拉取请求中有3个修改过的文件(没有新文件)。

我想从拉取请求中移除其中的一个文件,这样拉取请求只包含两个文件的变化,并将第三个文件保留在原始的未触摸状态。



我已经尝试了几件事(检查文件的原始版本等等),但它仍然显示为PR中已更改的文件。 p>

是否有解决方案?

解决方案

切换到分支你创建了pull请求:

$ p $ $ git checkout pull-request-branch

使用另一个分支中的文件覆盖修改后的文件,我们假设它是 master

  git checkout origin / master  -  src / main / java / HelloWorld.java 

提交并将其推送到远程:

  git commit -m从请求中删除了一个修改过的文件
git push origin pull-request-branch


I have 3 modified files (no new files) in a pull request at the moment.

I would like to remove one of those files from the pull request, so that the pull request only contains changes to two files and leaves the third in its original, untouched state.

I have tried a couple things (checking out the original version of the file, etc...) but it still shows as a changed file in the PR.

Is there a solution to this?

解决方案

Switch to the branch from which you created the pull request:

$ git checkout pull-request-branch

Overwrite the modified file(s) with the file in another branch, let's consider it's master:

git checkout origin/master -- src/main/java/HelloWorld.java

Commit and push it to the remote:

git commit -m "Removed a modified file from pull request"
git push origin pull-request-branch

这篇关于从拉取请求中移除已修改的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆