Level Up Your Git and GitHub Experience by Jordan McCullough and Brent Beer
Click here to load reader
-
Upload
zeroturnaround -
Category
Technology
-
view
461 -
download
0
Transcript of Level Up Your Git and GitHub Experience by Jordan McCullough and Brent Beer
![Page 1: Level Up Your Git and GitHub Experience by Jordan McCullough and Brent Beer](https://reader037.fdocuments.net/reader037/viewer/2022100517/554f3d83b4c905cd048b5217/html5/thumbnails/1.jpg)
GeekOut Estonia 2013
Level Up Your Git and GitHub Experience
GitHub is home to over three million people who use it as the definitive place to collaborate around code. What started five years ago assimple Git hosting is now a toolbox of collaborative features that continues to grow with new-emerging features and usages. Join BrentBeer and Jordan McCullough as they explore tips, techniques, and GitHub workflows that will help you level up your collaborative codingskills
Maximizing Use of GitHub
Link to issues by number as text
Mention in commit with #<issue number>Issue auto-updated with commit referencePull Requests are issuesExternal repo issue referencing
<username>/<repo>#<number>
Issues with Commit Integration
Commit message auto close when issue mentions included<fixes|fixed|fix> #xxx<resolve| resolves | resolved> #xxx<closes|close|closed> #xxx
Issues reference a Commit
Commit hash linking in issues (automatic)
Mentions in Pull Requests, Issues
@ mention account handlesSupport for users and teamsLine-by-line commentingAuto-linking in issuesBranches update automatically
GitHub-Flavor-Markdown and Task Lists
Support with - [ ] markdownModify and update with a click
GitHub URL Tricks
Ranges <repo-url>/compare/<ref>...<ref><branch>@{1.day.ago}
Commiters / Authors<url>?author=<name>
<url>?commiter=<name>
Understanding GitHub Branch Metrics
![Page 2: Level Up Your Git and GitHub Experience by Jordan McCullough and Brent Beer](https://reader037.fdocuments.net/reader037/viewer/2022100517/554f3d83b4c905cd048b5217/html5/thumbnails/2.jpg)
Same as command line git branch -vvShows what is behind/ahead from parent and commit relationship
Resolving Auto-Merge Conflicts
GitHub.com PR cannot be completedResolve on command line
git ls-remote
Retrieving from same repoUsing FETCH_HEADBranching fromMerging fromResolving with
Reverse MergeAssess first with git fetch
Forks
Keeping up to dateAdding a secondary remoteFetching (read), merging (local), pushing (write)
RefSpec & Airplane Mode
Pattern <src>:<dstn>What’s the +Limited what is fetchedTraditional fetch retrieves only refs/headsRetrieve Pull Requests with git ls-remote
Retrieving with Fetch
git config remote.<name>.fetch <src:dst>
+refs/heads/*:refs/remotes/origin/*
+refs/heads/master:refs/remotes/origin/master
+refs/heads/qa/*:refs/remotes/origin/qa/*
git config --add remote.<name>.fetch <refspec>
+refs/pull/*/head:refs/remotes/origin/pull/*
Controlling Pushes
git config remote.<remote>.push <refspec>
refs/heads/master:refs/heads/qa/master
refs/heads/qa/master:refs/heads/qa/master
Gists (quick one-branch repos)
Commit on GitHubClone down locallyFork, edit, share, starpushing to multiple gists with multiple remotes. ex) git push oscon oscon:master
Cherry-Pick
git cherry-pick <ref>
git cherry -v <ref>
![Page 3: Level Up Your Git and GitHub Experience by Jordan McCullough and Brent Beer](https://reader037.fdocuments.net/reader037/viewer/2022100517/554f3d83b4c905cd048b5217/html5/thumbnails/3.jpg)
Verifying picks before discarding a branch
IRL ExamplesRetrieving good work from prototype branchesIntegrating selected commits from a Pull RequestThen use commit message fixes #<val> to auto close PR
Rebase Interactive
General usegit rebase -i <ref|ref-range>
Anticipating many commits with autosquashgit commit -i --autosquash
Configure as default on any rebasegit config rebase.autosquash
Rebase - Configurations & Shortcuts
Apply local commits on top of fetch mergegit pull --rebase <origin> <branch>
Configuration for branch rebase default on push with -ugit config branch.autosetuprebase always|never|local|remote
Specific branch rebasing behavior configurationgit config branch.<name>.rebase true
Searching, Blaming, & Responsibility
By patch contentgit log -S "<content-string>"
By regex on commit messagegit log --grep=<regex>
By author name or timegit log --committer=<name>
git log --since=7.months.ago
By Filtergit log --diff-filter=<A|D|M>
By FileLast commit affecting each line changedgit blame <filepath>
git blame -L<start-line>,<end-line>
Cleaning Remotes
Remove non-matching local remote branchesgit remote update --prune
Remove non-matching remote upstream branchesgit push <remote> --prune
Remove only remote upstream branchgit push origin :<branch-name>