Advanced GIT for Developers
summary
Covers concrete Git techniques and internals: explains objects and that branches are plain pointers, shows how git add -p stages hunks, demonstrates resolving merge conflicts and enabling reuse of recorded resolutions, uses git log --oneline --decorate --all --graph to read history, walks through rebasing and git rebase -i for rewriting commits and fast‑forward vs --no-ff merges, runs git bisect run test.sh to find regressions, and configures .gitattributes, diff tools, bare repos and submodules.
AI-written summary · about
chapters (34)
- 0:00Start
- 0:44Advanced Git
- 2:46Initializing a New Git Repository
- 5:57Branches
- 9:38Git Add
- 11:58Merge Conflict
- 14:02Git Merge
- 19:30Reuse Recorded Resolutions
- 20:36Git Reset
- 21:53Resolving a Git Conflict
- 24:03Rebasing
- 25:50Git Rebase
- 27:59Generate Random Changes
- 30:24Fast-Forward Merge
- 33:38Git Rebase Interactive
- 33:51Git Rebase-I for Interactive
- 40:55Git Diff
- 41:51If You Want To See What Is in Your Next Commit Which I Find Immensely More Useful Then You Need To Do Get Diff-- Staged and this Will Show You the Things That Are Going To Be in Your Next Commit So if You'Ve Added a Few Things Maybe You Got Interrupted Then You Can Do Get Diff-- Staged What Am I About To Inflict on the World and Remember I Already Said You Can Do the Get Reset with-P so You Need To Just Pull a Few Things Out and Add Something You Can Very Much Shuffle those Things Around if You Want To See Everything That's Happened since the Last Commit Then You Can Get Diff against Head Head Is a Revision Number Which Always Means the Thing I Last Committed and Therefore the Thing That Will Become the Parent of My Incoming Commit My Next Commit
- 42:19If You Want To See Everything That's Happened since the Last Commit Then You Can Get Diff against Head Head Is a Revision Number Which Always Means the Thing I Last Committed and Therefore the Thing That Will Become the Parent of My Incoming Commit My Next Commit so that Shows Me both Changes Get Diff with Head another Way of Looking at Diff Other than this Kind of Inline Ascii Kind Of View Most of You Probably Have some Kind of Gui Tools My Hair Source Tree Is Very Good I Use Meld You'Re About To See It There Are Other Ways That We Can Look at this Everywhere that You Can Do Diff You Can Do Diff Tool So Get Diff All this Is a Bit Hard To Read Get Diff Tool and It Will Pick a Different Thing Which You Can Configure Mine's Currently Configured to Vin Diff
- 43:52And Again Same as Vim Do if You Can Move Changes from One Side to the Other and Inspect and Compare Then Meld Also Has a Mode Where You Can Get It To Show You the Whole Diff and It Opens like a Tree with Just the Changed Files so You Can See There's a Database Patch There's a Controller Change and There's Also Two Template Changes and It Shows You Just those Files and Lets You Open Them in Side-by-Side View As Well all of You Should Have Access to Tools That Do this Your Ide S Will Do this Source Tree Will Do this Meld Is Cross-Platform Be Really Certain because Especially When You Get beyond Doing a Bit or Working on Your Own
- 45:50If You Have a File Type That Is like the Minified Css Stuff Tends To Do this That Kind Of Looks like Text except Makes no Sense When Difft You Can Just Categorize It as Binary and Git Will Just Tell You these Files Have Changed and Stop Trying To Show You the Whole Diff and Making It Impossible To Read so that's Really Useful I'Ve Also Used this Text Conf Setting Which Is Saying Here Is a Program That Knows How To Render Files in this Category
- 46:12I'Ve Also Used this Text Conf Setting Which Is Saying Here Is a Program That Knows How To Render Files in this Category as Text so It's Going To Allow Me To Diff by Converting Them to a Textual Representation and Here Is a Document That I Made Earlier So I'Ve Got the Document and I'Ve Committed It Has To Be Committed for Me To Diff It Right so It's in Here It Is so We'Ll Edit this Document It Is a Document It Says this Is a Document It Has some Content in the Document
- 46:35And I'Ve Committed It Has To Be Committed for Me To Diff It Right so It's in Here It Is so We'Ll Edit this Document It Is a Document It Says this Is a Document It Has some Content in the Document and I Will Now Edit the Document this Is So Exciting I Probably Then Give You a Get a Vim Command To Close It because I Find this Incredibly Complicated There We Go Git Status Shows Us the File Has Changed Git Diff Gives Me the Text Rendering Including the Diff of the Changes Made to that Document this Is Sometimes Helpful if You Do Have like a Pdf Handbook or some Kind of Rich Text Thing It Doesn't Come Up Loads
- 46:51This Is So Exciting I Probably Then Give You a Get a Vim Command To Close It because I Find this Incredibly Complicated There We Go Git Status Shows Us the File Has Changed Git Diff Gives Me the Text Rendering Including the Diff of the Changes Made to that Document this Is Sometimes Helpful if You Do Have like a Pdf Handbook or some Kind of Rich Text Thing It Doesn't Come Up Loads More Often You'Re Likely To Need the Binary Setting because although Git Has Extensive Knowledge of a Load of File Formats Specialized Projects Are Very Likely To Have some Custom Ones
- 47:15This Is Sometimes Helpful if You Do Have like a Pdf Handbook or some Kind of Rich Text Thing It Doesn't Come Up Loads More Often You'Re Likely To Need the Binary Setting because although Git Has Extensive Knowledge of a Load of File Formats Specialized Projects Are Very Likely To Have some Custom Ones so You Can Mark It as Binary Just To Stop It Showing Up in Your Diff It's Irritating and if You Want To if There's a Way if It's Text Ish Find a Text Conversion Handler and Set It Up like this Super Helpful and I Do Have some Repose Which Are Sort Of Mixed
- 50:19The Page Whatever It Is You Need To Do To Verify if that Bug Exists in My Case I'M Looking for Does the File Stuff One Exists Okay the Bug Is We Deleted Stuff One Right So I Can Test for that Oh Let Me Show You this Give You a Sense of Where You Are but Get Bisect Visualize Shows You Where We Are So this that Top Pane Shows You these Are All the Commits and You Can See We'Re Currently in the Middle and Then It Will Show You I'Ve Eliminated these One Now I'M Working on this Section
- 51:14And if You Look Closely There's this Test Sh File Which Is Mysteriously Appeared in My Directory Which Just Tests for the Existence of Tests of Stuff One Txt and It Uses the Exit Status of the Script To Say this Is Good this Is Bad You Could Do this by Wrapping a Php Unit and Call because It's Exit Statuses Will Always Be Correct You Could Use any of Your Other Testing Tools Again They'Ll Return Successful Live It's Cool and Not if It's Not so You Just Need a Tap You Need a Script That Says Yes or No Depending if the Problem Is There or Not Crucial Thing To Know this Script Should Not Be under Source Control
- 52:05So if You Need To Like Copy Your Test or Something if You Haven't Had if You Didn't Have Your Test at the Time That You Broke this Thing Then either Don't Commit It or Just Yeah It Can't Be in Source Control because You Lose It When You Go Back in History this Is Just Hanging About in My Working Directory So I Can Use My Script by Doing Git Bisect Run Test Sh and It Goes through Trying a Bunch of Different Commits and if You Were To Look at these on My History They Literally Does Okay It Was Working Here Here Oh No I Was Broken Yeah Found It and It Comes Back and Says Oh It's the Commits with the Message Deleted a File You Would Never Have Guessed Right I Just Needed Something Really Obvious so that I Would Know I'D Shown You the Right Thing As Well
- 53:48So Especially if You Work with People Who Are Less Experienced in Git I Find that I Normally Then Need To Write a Cheat Sheet on How To Make Sure that Everything Is Pushed and Committed that Should Be I Love Sub Modules Think They'Re a Fabulous Feature and this Is Coming from Someone Who Was a Subversion Power User and Liked Externals and Kind Of Hated some Modules for a While I Love Them I Love Them I Love Them and There's a Bunch of Things You Can Do Instead You Guys Are Big into Modern Tools so You Have Composer so There Are Lots of Reasons Why You Can Just Like Rely on Your Own Composer Branch
- 55:10So I Think It's Awesome and I Want To Show You How To Do It I'M Just Going To Cheat and Set this Up Quickly so I'M Initializing aa Repository Called Sub Mod Making some Changes in It and Cloning into a Bear Repository So I'Ve Got a Working Repository in Sub Mod and Then I'Ve Got Main Mod Which Is Where My Module Lives so that's like the Server Thing We'Re Going To Pull from
- 55:38I Definitely Feel like Naming Things Is Hard Right Now Okay so that's the Name of My Parent Project and I'Ve Got some Commits in My Parent Project Nothing Else Has Happened Yet at Which Point I Add a Sub-Module Get Sub Module Commands Are One of the Few Places Where It Matters Where in the Hierarchy You Are like Where in the Directory Structure You Are so You Need To Run these from the Top Level and I Am Adding Get Sub Module Called Sub Mod on the Repository and Again It's a File Repo Slash Main Mod Get that Could Be a Github Url It Could Be Pointing to Your Work Get Lab Whatever Wherever You Keep Your Code in this Case Mines All Local so that if I Go Places without Working Wi-Fi It's Not a Problem
- 56:20It Could Be Pointing to Your Work Get Lab Whatever Wherever You Keep Your Code in this Case Mines All Local so that if I Go Places without Working Wi-Fi It's Not a Problem and Get Status Shows Me First of all There's a New File Called Sub Mod You Know You Would Expect that To Be a Directory It Is a Directory It's Just Showing It You as a File and There's Also a New Entry and Dot Git Modules and if You Have a Look in Up Come on Get Modules Is That Describes My Sub Module
- 57:23I Can Edit a File It's Status Shows Me the File Is Modified but if I Go Up into the Main Project So out of My Sub Module into Them the Module Itself Gets Status Shows Me Something's Happened over There It's Just like that Thing Did Something Happened and It Keeps this Really Kind Of Isolated Way of Working that the Parent Project Kind Of Knows that Something's Going On over There but It Can't Show You What's Happening inside that Directory It's Very Black Box
- 57:48And It Keeps this Really Kind Of Isolated Way of Working that the Parent Project Kind Of Knows that Something's Going On over There but It Can't Show You What's Happening inside that Directory It's Very Black Box So I Think Works Really Well so We Go Back in Here I'Ve Got My Edited File I Can Add It Yeah Nice I'M So Good at this Right and We Can Push this Up to Our Repository so We Created a Sub Module All the Repository We Pulled It into a Project We Made Changes inside that We Pushed It Back to Its Remote








