This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the git category.
Last Updated: 2024-12-03
Say you have some changes that aren't committed and you want to merge in some
remote changes. git stash
is the normal way to persist these changes prior to
merging, but it can be a bit clunky. Here's another way:
git diff > changes.patch
git apply changes.patch
Another use-case of patches is to move git changes around between two repos when they are not connected via internet. Just put the patches on a USB stick.