git 如何从拉取请求中排除文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15392003/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to exclude files from a pull request?
提问by Cory
I will like to perform a pull and merge request but also I would like to exclude some files from this pull request.
我想执行一个拉取和合并请求,但我也想从这个拉取请求中排除一些文件。
Example: a.py b.py c.py
I would like to peform a pull request and merge except b.py
file.
我想执行拉取请求并合并除b.py
文件。
What is the easiest way to accomplish this?
实现这一目标的最简单方法是什么?
[edit] the file is not committed it yet.
[编辑] 该文件尚未提交。
回答by CharlesB
Make two branches from where you are right now, for example my-pull-request
and other-change
.
从您现在所在的位置创建两个分支,例如my-pull-request
和other-change
。
Commit a.py and c.py to my-pull-request
, and b.py to other-change
. Push the my-pull-request
branch to Github, and create the pull request.
将 a.py 和 c.py 提交到my-pull-request
,并将 b.py 提交到other-change
。将my-pull-request
分支推送到 Github,并创建拉取请求。
回答by favoretti
Commit a.py
and c.py
, git stash
the rest, perform the request, then git stash pop
to restore your b.py
提交a.py
和c.py
,git stash
剩下的,执行请求,然后git stash pop
恢复你的b.py
回答by edaype
Try pulling all the files and reverse the files to a specific commit. Then push your changes if you want. You can also stack your changes, pull and then apply your stack
尝试拉取所有文件并将文件反转到特定提交。然后根据需要推送您的更改。您还可以堆叠您的更改,拉取然后应用您的堆栈