Selectively merging branches with git

git-checkout is the key here. Here are the quick steps:

  1. Checkout the branch you want to merge into: git checkout production
  2. git checkout feature_branch_name <list of files> to merge just the changes from specific files: git checkout push-notif-branch app/controllers/controller.rb config/certificates/* …
  3. Git automatically does a git add into your initial branch with the files you specified. Just follow up with a git commit -m “message” and you’re done!