5,321
edits
(→Linux) |
|||
Line 62: | Line 62: | ||
git checkout my_branch -- other_file.txt | git checkout my_branch -- other_file.txt | ||
</syntaxhighlight> | </syntaxhighlight> | ||
==Patches== | |||
Patches are a way to represent and share changes without actually making commits or new branches. | |||
<syntaxhighlight lang="bash"> | |||
# For unstaged changes | |||
git diff > changes.patch | |||
# For staged changes | |||
git diff --cached > changes.patch | |||
# You can also add --binary to include binary files | |||
# Apply the patch | |||
git apply changes.patch | |||
</syntaxhighlight> | |||
See [https://stackoverflow.com/questions/5159185/create-a-git-patch-from-the-uncommitted-changes-in-the-current-working-directory create git patch] | |||
==Pull Requests== | ==Pull Requests== |