本文介绍了仅请求某些文件/提交的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个存储库,该存储库是从 GitHub 分叉的,对该存储库进行了一些修改.但是,在某个提交中,更改了一些我要提交请求请求的文件,而将其他修改后的文件排除在请求之外.

I have a repository that is forked from GitHub that has a few modifications made to it. However, in a certain commit, a few files were changed that I want to submit a pull-request for, leaving the other modified files out of the request.

拉取请求会合并所有所有提交,还是我需要做一些特殊的事情来隔离此提交?

Do pull requests merge all commits, or do I need to do something special to isolate this commit?

推荐答案

一个由整个提交组成的请求请求,您需要将此提交分为两个单独的提交,一个包含要放入请求请求的更改,另一个举行其他更改.为此,您需要git rebase -i,例如,请参见如何拆分历史记录中的Git提交?很好的解释.

A pull request being made of whole commits, you need to split this commit into two separate commits one containing the change to put in the pull request, and the other holding the other changes. To do this you need git rebase -i, see for example How can I split up a Git commit buried in history? for a good explanation on how to do it.

将提交拆分后,将要包括的提交移动到主题分支中,例如,参见如何移动某些提交到git中的另一个分支?,但这取决于发出拉取请求的提交是否是连续的.

Once you have split the commit, move the ones you want to include into a topic branch, see for example How to move certain commits to another branch in git?, but it depends if the commits that make your pull request are sequential.

最后,您可以推送到Github并从您的主题分支创建拉取请求.

Then finally you can push to Github and create the pull request from your topic branch.

这篇关于仅请求某些文件/提交的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-04 20:22