@@ -52,13 +52,13 @@ These are called Branching Strategies, but are just as easily called *Team Colla
52
52
* [ What to do when things get complicated] ( http://blog.springsource.org/2011/07/18/social-coding-pull-requests-what-to-do-when-things-get-complicated/ )
53
53
54
54
## Applying branching patterns
55
-
56
55
### Summary
57
56
* Breaking features down into pieces
58
57
* Feedback early on Pull Requests
59
58
* @mentioning teams instead of individuals
60
59
* Continuous integration
61
60
61
+
62
62
## Branch pull options
63
63
### Summary
64
64
* Fetch single branch
@@ -67,12 +67,36 @@ These are called Branching Strategies, but are just as easily called *Team Colla
67
67
* ` FETCH_HEAD `
68
68
* ` MERGE_HEAD `
69
69
70
+
70
71
## Inserting Commits Into Existing History
71
72
### Summary
73
+ * Reusing small pieces of code with ` cherry-pick `
74
+ * Why use ` cherry-pick ` instead of ` merge ` ?
75
+ * What happens when you ` cherry-pick ` ?
76
+ * Maintaining ` author ` and ` committer ` fields
77
+ * Tracing any cherry-picks with ` -x ` commit message metadata
78
+ * ` -x ` metadata hyperlinked on GitHub
79
+ * ` git cherry ` to view absent commits
72
80
* Rebase interactive
73
- * Can include cherry-pick
74
- * Must remember to continue the rebase
75
- * Alters history
81
+ * Can include cherry-pick
82
+ * Must remember to continue the rebase
83
+ * Alters history
84
+
85
+ #### Details
86
+ ```
87
+ $ git cherry-pick [ref]
88
+ $ git cherry-pick [ref1] [ref2]
89
+
90
+ $ git branch --contains [noncherrypickedref]
91
+ $ git cherry [upstreambranch]
92
+
93
+ + bd650366fa8c39f03cfc9dd5290f60e7331a631d
94
+ + ea62f9f6a7cef55a8a3028e617d28819408a63c4
95
+ + 874628c0e405390130d6457776273451bb66d3a8
96
+ + 046a9b8d0f2363361e45cfbc7e0f6d82968f2f9f
97
+ + 315fe16408f9a9080527e00df3d9a8c1ba0dc97a
98
+ ```
99
+
76
100
77
101
## Undoing and Re-doing Almost Anything
78
102
### Summary
@@ -189,6 +213,23 @@ git push origin :<tag-name-to-delete>
189
213
* PRs multiple levels up
190
214
* Converting issues to PRs
191
215
* PRs as Issues with code
216
+ * Automatic closing of PRs by local merges
217
+ * Merges must be _ made by recursive_
218
+ * Retrieving PRs locally to resolve conflicts
219
+ (without locally merging to target branch)
220
+
221
+ #### Details
222
+ ```
223
+ $ git ls-remote origin
224
+ $ git fetch origin refs/pull/1/head
225
+
226
+ From github.com:youruser/somereponame
227
+ * branch refs/pull/1/head -> FETCH_HEAD
228
+
229
+ $ git show FETCH_HEAD
230
+ $ git merge --no-commit --no-ff FETCH_HEAD
231
+ ```
232
+
192
233
193
234
## GitHub API
194
235
@@ -215,13 +256,32 @@ git push origin :<tag-name-to-delete>
215
256
#### Details
216
257
```
217
258
# Add in patch mode
218
- git add -p
259
+ $ git add -p
219
260
220
261
# Add interactively
221
- git add -i
262
+ $ git add -i
222
263
223
264
# The GitHub for Mac desktop client
224
- github
265
+ $ github
266
+ ```
267
+
268
+ ## Stashing with precision
269
+
270
+ ### Summary
271
+ * Name your stash
272
+ * List stashes
273
+ * Use specific stashes
274
+
275
+ #### Details
276
+ ```
277
+ $ git stash save "<description>"
278
+ $ git stash --include-untracked
279
+ $ git stash list
280
+ $ git stash pop <name>
281
+ $ git stash drop <name>
282
+ $ git stash apply
283
+ $ git stash clear
284
+ $ git stash -p
225
285
```
226
286
227
287
## Committing Efficiencies
@@ -264,70 +324,7 @@ $ git commit -m "This resolves #[issue]"
264
324
```
265
325
266
326
267
- ## Advanced GitHub Pull Requests
268
- * Automatic closing of PRs by local merges
269
- * Merges must be _ made by recursive_
270
- * Retrieving PRs locally to resolve conflicts
271
- (without locally merging to target branch)
272
-
273
- #### Details
274
- ```
275
- $ git ls-remote origin
276
- $ git fetch origin refs/pull/1/head
277
-
278
- From github.com:youruser/somereponame
279
- * branch refs/pull/1/head -> FETCH_HEAD
280
-
281
- $ git show FETCH_HEAD
282
- $ git merge --no-commit --no-ff FETCH_HEAD
283
- ```
284
-
285
- ## Stashing with precision
286
-
287
- ### Summary
288
- * Name your stash
289
- * List stashes
290
- * Use specific stashes
291
-
292
- #### Details
293
- ```
294
- git stash save "<description>"
295
- git stash --include-untracked
296
- git stash list
297
- git stash pop <name>
298
- git stash drop <name>
299
- git stash apply
300
- git stash clear
301
- git stash -p
302
- ```
303
-
304
- ## Reusing small pieces of code with ` cherry-pick `
305
-
306
- ### Summary
307
- * Why use ` cherry-pick ` instead of ` merge ` ?
308
- * What happens when you ` cherry-pick ` ?
309
- * Maintaining ` author ` and ` committer ` fields
310
- * Tracing any cherry-picks with ` -x ` commit message metadata
311
- * ` -x ` metadata hyperlinked on GitHub
312
- * ` git cherry ` to view absent commits
313
-
314
- #### Details
315
- ```
316
- $ git cherry-pick [ref]
317
- $ git cherry-pick [ref1] [ref2]
318
-
319
- $ git branch --contains [noncherrypickedref]
320
- $ git cherry [upstreambranch]
321
-
322
- + bd650366fa8c39f03cfc9dd5290f60e7331a631d
323
- + ea62f9f6a7cef55a8a3028e617d28819408a63c4
324
- + 874628c0e405390130d6457776273451bb66d3a8
325
- + 046a9b8d0f2363361e45cfbc7e0f6d82968f2f9f
326
- + 315fe16408f9a9080527e00df3d9a8c1ba0dc97a
327
- ```
328
-
329
327
## History analysis
330
-
331
328
### Summary
332
329
* Commit ranges to review branch differences
333
330
* Verifying merges have completed
@@ -397,7 +394,7 @@ $ git push origin :<branch-name>
397
394
$ git checkout <featurebranch>
398
395
$ git rebase master
399
396
400
- $ git config branch.autosetuprebase
397
+ $ git config branch.autosetuprebase always
401
398
$ git config branch.[master].rebase true
402
399
```
403
400
@@ -643,7 +640,7 @@ $ gitk --all
643
640
644
641
## Refspecs
645
642
### Summary
646
- * Specification for retrival and pushing
643
+ * Specification for retrieval and pushing
647
644
* Implied on fetch, pull, and push
648
645
* Altered by option switches like ` --tags `
649
646
* Stored in ` .git/config `
0 commit comments