[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,{\i1}Git Rebase{\i0} is the ability\Nto take existing commits, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and to place them on a branch\Nthat starts today. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,♪ (jazzy theme music throughout) ♪ Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Creating a branch is a tough decision. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Start it today, or start it later? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Well, some important fixes\Nmight be happening right now. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,So better wait until tomorrow. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,That difficult decision\Nhas gone away with {\i1}Git{\i0}. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Start a branch whenever you like, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and make it contain the changes\Nthat you intend to deliver. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Focused on a particular feature, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,bug fix, or objective. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,What about wanting this to start Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,at a later place in history, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,in order to incorporate those hot fixes Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that are going on to the master branch? Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,No problem.\N{\i1}Rebase{\i0} to the rescue. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,{\i1}Rebase{\i0}, in its standard usage form, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,allows one branch to be relocated\Nfarther down the history track, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,meaning taking all of the changes\Nthat are isolated on your branch, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and acting as if they happened {\i1}after{\i0} Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,all of the modern work\Non the master branch. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,This accomplishes the same thing,\Nbut with cleaner history, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,than doing a reverse merge Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,from the master branch\Nto the feature branch. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,The same contents will be present\Nin the feature branch, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but without the complication of the merge, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,going into that feature branch,\Nand recorded in its history. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It's important to note\Nthat the {\i1}rebase{\i0} command Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is altering all of the commits\Npresent in the branch. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It's preserving all of the work you did, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,but their location and relationship\Nto other commits Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is all changing. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,This is primarily used for a branch\Nthat {\i1}you only{\i0} own, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and isn't being worked on by others. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,The change in the relationship, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and identifier for each of those commits, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,makes it difficult to reconcile\Nwith the work of others. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,We're primarily talking about a branch\Nthat {\i1}you{\i0} are focused on. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,But with those constraints in place,\Nthe use is quite simple. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,{\i1}git checkout{\i0} to the feature branch, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,{\i1}git rebase{\i0} on the source branch,\Ntypically {\i1}master{\i0}. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,That will then iteratively walk through\Nall of the commits Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that have happened on the feature branch, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and replay them as if they were being\Nrobotically rewritten, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,starting from the latest point in time\Non the master branch. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,When the process completes, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,after seeing it step through\Nall of the individual commits, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,it will let you know that\Nthe {\i1}rebase{\i0} is complete, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and you'll return to the command prompt Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,and what appears to be a similar state Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to before you ran that instruction. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,However, all of those historical commits\Nnow have new identifiers, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,keep that in mind. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,You'll find a request to use this pattern Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,is most common in open source projects. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It's because they want to optimize Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,for future readership of the code base. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,A single straight line of history\Nprovides the easiest reading Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,for a future contributor to this project. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,This is why they put the burden\Non the contributors, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to make the history clean. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,It's an effort, but one that benefits Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,every future collaborator on this project. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Continuously delivered applications, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,such as web services, and web apps, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,are optimized, generally,\Nfor merges, not {\i1}rebase{\i0}. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,They want the quickest possible\Ndelivery mechanism Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,to send a change, small and focused,\Ninto the master branch. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,If that doesn't do\Neverything that it should, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,another branch is worked on,\Nand merged back in again. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,{\i1}Rebase{\i0} is a powerful feature Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,that lets you optimize\Nfor clarity of history. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Just bear in mind the needs\Nof your project and your team. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,If it is for quick delivery\Nof feature branches, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,just merge them in. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,If it's for clarity of history,\Nengage in using {\i1}Rebase{\i0}. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Thanks for watching this\NGit & GitHub Foundations Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,episode on {\i1}Rebase{\i0}. Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,Be sure to subscribe\Nto our channel, over here, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,ask us questions or comments\Nin the box below, Dialogue: 0,9:59:59.99,9:59:59.99,Default,,0000,0000,0000,,or watch one of the related episodes,\Nsuch as on creating a branch.