Skip to content

Commit 12e2681

Browse files
author
Matthew McCullough
committed
Merge pull request #102 from github/update-workbooks-advanced
Advanced workbook consolidation and fixes
2 parents 4dbbe18 + 5b8a84c commit 12e2681

File tree

1 file changed

+69
-72
lines changed

1 file changed

+69
-72
lines changed

workbooks/github-advanced.md

Lines changed: 69 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,13 @@ These are called Branching Strategies, but are just as easily called *Team Colla
5252
* [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/)
5353

5454
## Applying branching patterns
55-
5655
### Summary
5756
* Breaking features down into pieces
5857
* Feedback early on Pull Requests
5958
* @mentioning teams instead of individuals
6059
* Continuous integration
6160

61+
6262
## Branch pull options
6363
### Summary
6464
* Fetch single branch
@@ -67,12 +67,36 @@ These are called Branching Strategies, but are just as easily called *Team Colla
6767
* `FETCH_HEAD`
6868
* `MERGE_HEAD`
6969

70+
7071
## Inserting Commits Into Existing History
7172
### 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
7280
* 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+
76100

77101
## Undoing and Re-doing Almost Anything
78102
### Summary
@@ -189,6 +213,23 @@ git push origin :<tag-name-to-delete>
189213
* PRs multiple levels up
190214
* Converting issues to PRs
191215
* 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+
192233

193234
## GitHub API
194235

@@ -215,13 +256,32 @@ git push origin :<tag-name-to-delete>
215256
#### Details
216257
```
217258
# Add in patch mode
218-
git add -p
259+
$ git add -p
219260
220261
# Add interactively
221-
git add -i
262+
$ git add -i
222263
223264
# 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
225285
```
226286

227287
## Committing Efficiencies
@@ -264,70 +324,7 @@ $ git commit -m "This resolves #[issue]"
264324
```
265325

266326

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-
329327
## History analysis
330-
331328
### Summary
332329
* Commit ranges to review branch differences
333330
* Verifying merges have completed
@@ -397,7 +394,7 @@ $ git push origin :<branch-name>
397394
$ git checkout <featurebranch>
398395
$ git rebase master
399396
400-
$ git config branch.autosetuprebase
397+
$ git config branch.autosetuprebase always
401398
$ git config branch.[master].rebase true
402399
```
403400

@@ -643,7 +640,7 @@ $ gitk --all
643640

644641
## Refspecs
645642
### Summary
646-
* Specification for retrival and pushing
643+
* Specification for retrieval and pushing
647644
* Implied on fetch, pull, and push
648645
* Altered by option switches like `--tags`
649646
* Stored in `.git/config`

0 commit comments

Comments
 (0)