Skip to content

Instantly share code, notes, and snippets.

@whoward
Created May 11, 2020 19:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whoward/7b2282d1e9d268b9dcd6308e4bc4ab34 to your computer and use it in GitHub Desktop.
Save whoward/7b2282d1e9d268b9dcd6308e4bc4ab34 to your computer and use it in GitHub Desktop.
bash function to apply a diff on a single file from another commit
# example: cpf c0fbe4 path/to/file.txt
function cpf() {
git diff -R $1 $2 | git apply
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment