Pull Request, ignore some file changes
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.
As mentioned in https://stackoverflow.com/a/28703636/12138397, it is not possible to exclude files in a Pull-Request, and the alternatives which have been proposed also work.
But there is a simpler solution to it. Here I am considering staging as my target and dev as my source
root
|-- src
| -- app.py
|-- .gitignore
|-- settings.py
|-- requirements.txt
Let's say, I would want to ignore the settings.py file from being merged
- First move to the target branch (the branch to which you want to merge the
changes)
git checkout staging
- Then you can use the git checkout command to selective pick the files you want to
merge
git checkout dev src/
This will only merge the files changed inside src/ folder
NOTE: You can also do it selectively for each file.
Then push to remote repository
git push origin staging
But this solution is useful only if the files to be excluded is small.