Git Trix - neal-erickson/dotfiles GitHub Wiki

Cherry Picking

  1. Get the commitShas of the commits you want to apply, e.g. f586430. Do them in the same order for sanity.
  2. Go to branch you want to apply commit to and run: git cherry-pick commitSha
  3. Fix any conflicts, if necessary

Options:

  • Can use the --no-commit flag to simply apply the changes to the working tree without a commit

Patching

  1. Get a patch file created using git diff {args} > mypatch.patch
  • Diff working tree to last commit: git diff
  • Diff current branch to another branch: git diff {other_branch_name}
  1. From destination branch, apply patch: git apply {patch_file}