Github – 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’.

  • Heroku not updating css for rails app
  • extract all files changed in a git commit
  • Git Submodules: It is possible to provide both https and ssh access to submodules?
  • Correctly committing versioned, and built (minified) files to GitHub with Gulp.js
  • Splitting a subdirectory with submodules into a separate git repository
  • Is it important to rebase?
  • Is there a branch history in git?
  • error with p4merge merging tool in git
  • How to merge my local uncommitted changes into another Git branch?
  • What's the equivalent of use-commit-times for git?
  • git conflict with differently cased directory name
  • post-receive hook fails - any chance to see why?
  • 2 Solutions collect form web for “Github – 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.

    Create branch with last commit you agree with:

    git branch my-branch <sha>
    git checkout my-branch
    

    Select commits you want to pull request as patches:

    git format-patch -10 <sha> --stdout > 0001-last-10-commits.patch
    

    Apply patches:

    git am < 0001-last-10-commits.patch
    

    Your commits will be as they was. You can git push -u origin my-branch immediately.

    Git Baby is a git and github fan, let's start git clone.