Skip to content

Instantly share code, notes, and snippets.

@adRn-s
Last active November 14, 2023 09:17
Show Gist options
  • Save adRn-s/fff09e92f80dad1f5e39e689fb62e2fa to your computer and use it in GitHub Desktop.
Save adRn-s/fff09e92f80dad1f5e39e689fb62e2fa to your computer and use it in GitHub Desktop.
Moving any commit (a diff-patch) throughout machines!
git apply --verbose 0001-name-your-file.patch
# Retrieving from different 'sources'
### from unstaged changes
git diff > 0001-name-your-file.patch
### from staged changes
git diff --cached > 0001-name-your-file.patch
### latest commit
git format-patch -1 HEAD
### specific commit
git format-patch -1 d173e1b
### from 2nd stash
git stash show -p stash@{1} > 0001-name-your-file.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment