Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull Request, ignore some file changes

When I do a Pull Request on GitHub (against master branch), can we ignore some file changes, like

  • we have one file named 'fileA' in branch 'release', and we have the same file in 'master', but we do some changes in 'fileA' in branch 'release'
  • when we do a Pull Request, is there any way we can ignore the changes in 'fileA', do not let that merge into 'master'.
like image 828
LongYang0806 Avatar asked Feb 24 '15 18:02

LongYang0806


People also ask

How do I ignore changes to a file?

In the Git Changes window, right-click any changed file that you want Git to ignore and choose Ignore this local item or Ignore this extension. Those menu options don't exist for tracked files.

How do I only put certain files in a pull request?

Pull requests merge branches. So if you want to isolate some things for a pull request, best is to put those changes in a separate branch. Advantage is that you can change the pull request by pushing new changes to that branch (even push -f if you need to change already pushed commits).

How do I ignore unwanted changes in git?

To avoid having to ignore unwanted files manually, you can create a . gitignore file in the working directory of your project. Inside this file, you can specify simple patterns that Git will use to determine whether or not a file should be ignored.


1 Answers

You can't ignore some files from a pull request selectively. Two workarounds for this can be -

First -

  • Create a new branch from 'release'
  • Replace the non-required files from 'master'
  • Create pull request from this new branch

Second -

  • Create a new branch from 'master'
  • Put changes of required files from 'release'
  • Create pull request from this new branch

Any of this method will work. Which will be easier depends upon how many files are to be included / excluded.

like image 56
Raj Srivastava Avatar answered Oct 03 '22 06:10

Raj Srivastava