Skip to content

Commit 86226a5

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main'
2 parents 6ff5acf + b5cdc3c commit 86226a5

7 files changed

+339
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
- [Switch Between Worktrees](./contents/switch-between-worktrees.md)
4040
- [Use Worktrees for Temporary Fixes](./contents/use-worktrees-for-temporary-fixes.md)
4141
- [Flags and Their Uses](./contents/flags-and-their-uses.md)
42+
- [Sharing Changes as Patch Files](./contents/sharing-changes-as-patch-files.md): Generate and share patch files for committed or uncommitted changes.
43+
- [Create Patch from Last Commit(s)](./contents/create-patch-from-last-commit-s.md)
44+
- [Apply Patch with Commit Metadata](./contents/apply-patch-with-commit-metadata.md)
45+
- [Create Patch from Uncommitted Changes](./contents/create-patch-from-uncommitted-changes.md)
46+
- [Apply Diff File](./contents/apply-diff-file.md)
47+
- [Patch vs Diff: Quick Reference](./contents/patch-vs-diff-quick-reference.md)
4248

4349

4450
## Contributors & Credits

contents/apply-diff-file.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Apply Diff File
2+
3+
4+
![Category: Patch & Diff](https://img.shields.io/badge/Category-Patch%20%26%20Diff-blue)
5+
6+
#### Command
7+
```sh
8+
git apply changes.diff
9+
```
10+
11+
#### Examples
12+
- **Apply a diff file of uncommitted changes.**
13+
14+
15+
```sh
16+
git apply changes.diff
17+
```
18+
19+
20+
#### Steps
21+
1. Run '`git apply changes.diff' to apply the changes from a diff file`.
22+
23+
24+
#### Tags
25+
`diff`, `apply`, `uncommitted`
26+
27+
#### Author
28+
mike-rambil
29+
30+
#### Last Updated
31+
2024-06-10
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Apply Patch with Commit Metadata
2+
3+
4+
![Category: Patch & Diff](https://img.shields.io/badge/Category-Patch%20%26%20Diff-blue)
5+
6+
#### Command
7+
```sh
8+
git am my-changes.patch
9+
```
10+
11+
#### Examples
12+
- **Apply a patch file and preserve commit info.**
13+
14+
15+
```sh
16+
git am my-changes.patch
17+
```
18+
19+
20+
#### Steps
21+
1. Run '`git am my-changes.patch' to apply the patch and preserve commit messages, authorship, and timestamps`.
22+
23+
24+
#### Tags
25+
`patch`, `am`, `apply`
26+
27+
#### Author
28+
mike-rambil
29+
30+
#### Last Updated
31+
2024-06-10
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Create Patch from Last Commit(s)
2+
3+
4+
![Category: Patch & Diff](https://img.shields.io/badge/Category-Patch%20%26%20Diff-blue)
5+
6+
#### Command
7+
```sh
8+
git format-patch HEAD~1
9+
```
10+
11+
#### Examples
12+
- **Create a .patch file for the last commit.**
13+
14+
15+
```sh
16+
git format-patch HEAD~1
17+
```
18+
- **Create a single patch file for all commits on top of main.**
19+
20+
21+
```sh
22+
git format-patch origin/main..HEAD --stdout > my-changes.patch
23+
```
24+
25+
26+
#### Steps
27+
1. Run '`git format-patch HEAD~1' to create a patch for the last commit`.
28+
2. Use '`git format-patch origin/main..HEAD --stdout > my-changes.patch' to create a single patch file for multiple commits`.
29+
30+
31+
#### Warnings
32+
- ⚠️ Patch files created this way include commit messages, authorship, and timestamps.
33+
- ⚠️ Use 'git am' to apply these patches on another system.
34+
35+
36+
#### Links
37+
- [Official Docs](https://git-scm.com/docs/git-format-patch)
38+
39+
40+
#### Tags
41+
`patch`, `format-patch`, `committed`
42+
43+
#### Author
44+
mike-rambil
45+
46+
#### Last Updated
47+
2024-06-10
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Create Patch from Uncommitted Changes
2+
3+
4+
![Category: Patch & Diff](https://img.shields.io/badge/Category-Patch%20%26%20Diff-blue)
5+
6+
#### Command
7+
```sh
8+
git diff > changes.diff
9+
```
10+
11+
#### Examples
12+
- **Create a diff file of uncommitted changes.**
13+
14+
15+
```sh
16+
git diff > changes.diff
17+
```
18+
19+
20+
#### Steps
21+
1. Run '`git diff > changes.diff' to save uncommitted changes to a file`.
22+
23+
24+
#### Warnings
25+
- ⚠️ This does NOT preserve commit metadata or history—just raw changes.
26+
27+
28+
#### Links
29+
- [Official Docs](https://git-scm.com/docs/git-diff)
30+
31+
32+
#### Tags
33+
`diff`, `uncommitted`, `snapshot`
34+
35+
#### Author
36+
mike-rambil
37+
38+
#### Last Updated
39+
2024-06-10
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Patch vs Diff: Quick Reference
2+
3+
4+
![Category: Patch & Diff](https://img.shields.io/badge/Category-Patch%20%26%20Diff-blue)
5+
6+
#### Tags
7+
`patch`, `diff`, `reference`
8+
9+
#### Author
10+
mike-rambil
11+
12+
#### Last Updated
13+
2024-06-10
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# Sharing Changes as Patch Files
2+
3+
4+
![Category: Patch & Diff](https://img.shields.io/badge/Category-Patch%20%26%20Diff-blue)
5+
> Generate and share patch files for committed or uncommitted changes.
6+
7+
How to create patch files from your changes for sharing via email, SCP, Slack, or other means. Covers both committed (with full commit metadata) and uncommitted changes.
8+
9+
10+
#### Tags
11+
`patch`, `diff`, `sharing`, `email`, `collaboration`
12+
13+
#### Author
14+
mike-rambil
15+
16+
#### Last Updated
17+
2024-06-10
18+
19+
---
20+
21+
### Subcommands
22+
#### Create Patch from Last Commit(s)
23+
24+
#### Command
25+
```sh
26+
git format-patch HEAD~1
27+
```
28+
29+
#### Examples
30+
- **Create a .patch file for the last commit.**
31+
32+
33+
```sh
34+
git format-patch HEAD~1
35+
```
36+
- **Create a single patch file for all commits on top of main.**
37+
38+
39+
```sh
40+
git format-patch origin/main..HEAD --stdout > my-changes.patch
41+
```
42+
43+
44+
#### Steps
45+
1. Run '`git format-patch HEAD~1' to create a patch for the last commit`.
46+
2. Use '`git format-patch origin/main..HEAD --stdout > my-changes.patch' to create a single patch file for multiple commits`.
47+
48+
49+
#### Warnings
50+
- ⚠️ Patch files created this way include commit messages, authorship, and timestamps.
51+
- ⚠️ Use 'git am' to apply these patches on another system.
52+
53+
54+
#### Links
55+
- [Official Docs](https://git-scm.com/docs/git-format-patch)
56+
57+
58+
#### Tags
59+
`patch`, `format-patch`, `committed`
60+
61+
#### Author
62+
mike-rambil
63+
64+
#### Last Updated
65+
2024-06-10
66+
67+
#### Apply Patch with Commit Metadata
68+
69+
#### Command
70+
```sh
71+
git am my-changes.patch
72+
```
73+
74+
#### Examples
75+
- **Apply a patch file and preserve commit info.**
76+
77+
78+
```sh
79+
git am my-changes.patch
80+
```
81+
82+
83+
#### Steps
84+
1. Run '`git am my-changes.patch' to apply the patch and preserve commit messages, authorship, and timestamps`.
85+
86+
87+
#### Tags
88+
`patch`, `am`, `apply`
89+
90+
#### Author
91+
mike-rambil
92+
93+
#### Last Updated
94+
2024-06-10
95+
96+
#### Create Patch from Uncommitted Changes
97+
98+
#### Command
99+
```sh
100+
git diff > changes.diff
101+
```
102+
103+
#### Examples
104+
- **Create a diff file of uncommitted changes.**
105+
106+
107+
```sh
108+
git diff > changes.diff
109+
```
110+
111+
112+
#### Steps
113+
1. Run '`git diff > changes.diff' to save uncommitted changes to a file`.
114+
115+
116+
#### Warnings
117+
- ⚠️ This does NOT preserve commit metadata or history—just raw changes.
118+
119+
120+
#### Links
121+
- [Official Docs](https://git-scm.com/docs/git-diff)
122+
123+
124+
#### Tags
125+
`diff`, `uncommitted`, `snapshot`
126+
127+
#### Author
128+
mike-rambil
129+
130+
#### Last Updated
131+
2024-06-10
132+
133+
#### Apply Diff File
134+
135+
#### Command
136+
```sh
137+
git apply changes.diff
138+
```
139+
140+
#### Examples
141+
- **Apply a diff file of uncommitted changes.**
142+
143+
144+
```sh
145+
git apply changes.diff
146+
```
147+
148+
149+
#### Steps
150+
1. Run '`git apply changes.diff' to apply the changes from a diff file`.
151+
152+
153+
#### Tags
154+
`diff`, `apply`, `uncommitted`
155+
156+
#### Author
157+
mike-rambil
158+
159+
#### Last Updated
160+
2024-06-10
161+
162+
#### Patch vs Diff: Quick Reference
163+
164+
#### Tags
165+
`patch`, `diff`, `reference`
166+
167+
#### Author
168+
mike-rambil
169+
170+
#### Last Updated
171+
2024-06-10
172+

0 commit comments

Comments
 (0)