[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:00.29,0:00:03.22,Default,,0000,0000,0000,,{\i1}Git Rebase{\i0} is the ability\Nto take existing commits, Dialogue: 0,0:00:03.22,0:00:06.54,Default,,0000,0000,0000,,and to place them on a branch\Nthat starts today. Dialogue: 0,0:00:06.73,0:00:08.94,Default,,0000,0000,0000,,♪ (jazzy theme music throughout) ♪ Dialogue: 0,0:00:12.36,0:00:14.50,Default,,0000,0000,0000,,Creating a branch is a tough decision. Dialogue: 0,0:00:14.72,0:00:17.13,Default,,0000,0000,0000,,Start it today, or start it later? Dialogue: 0,0:00:17.48,0:00:20.62,Default,,0000,0000,0000,,Well, some important fixes\Nmight be happening right now. Dialogue: 0,0:00:20.77,0:00:22.88,Default,,0000,0000,0000,,So better wait until tomorrow. Dialogue: 0,0:00:23.03,0:00:26.10,Default,,0000,0000,0000,,That difficult decision\Nhas gone away with {\i1}Git{\i0}. Dialogue: 0,0:00:26.49,0:00:27.95,Default,,0000,0000,0000,,Start a branch whenever you like, Dialogue: 0,0:00:28.16,0:00:31.39,Default,,0000,0000,0000,,and make it contain the changes\Nthat you intend to deliver. Dialogue: 0,0:00:31.51,0:00:33.35,Default,,0000,0000,0000,,Focused on a particular feature, Dialogue: 0,0:00:33.75,0:00:35.91,Default,,0000,0000,0000,,bug fix, or objective. Dialogue: 0,0:00:38.98,0:00:40.70,Default,,0000,0000,0000,,What about wanting this to start Dialogue: 0,0:00:40.70,0:00:42.38,Default,,0000,0000,0000,,at a later place in history, Dialogue: 0,0:00:42.38,0:00:44.65,Default,,0000,0000,0000,,in order to incorporate those hot fixes Dialogue: 0,0:00:44.65,0:00:46.43,Default,,0000,0000,0000,,that are going on to the master branch? Dialogue: 0,0:00:46.86,0:00:49.69,Default,,0000,0000,0000,,No problem.\N{\i1}Rebase{\i0} to the rescue. Dialogue: 0,0:00:50.04,0:00:52.78,Default,,0000,0000,0000,,{\i1}Rebase{\i0}, in its standard usage form, Dialogue: 0,0:00:52.78,0:00:57.87,Default,,0000,0000,0000,,allows one branch to be relocated\Nfarther down the history track, Dialogue: 0,0:00:58.36,0:01:02.90,Default,,0000,0000,0000,,meaning taking all of the changes\Nthat are isolated on your branch, Dialogue: 0,0:01:03.12,0:01:05.71,Default,,0000,0000,0000,,and acting as if they happened {\i1}after{\i0} Dialogue: 0,0:01:05.94,0:01:08.36,Default,,0000,0000,0000,,all of the modern work\Non the master branch. Dialogue: 0,0:01:09.02,0:01:12.71,Default,,0000,0000,0000,,This accomplishes the same thing,\Nbut with cleaner history, Dialogue: 0,0:01:12.71,0:01:14.58,Default,,0000,0000,0000,,than doing a reverse merge Dialogue: 0,0:01:14.58,0:01:17.29,Default,,0000,0000,0000,,from the master branch\Nto the feature branch. Dialogue: 0,0:01:17.71,0:01:20.48,Default,,0000,0000,0000,,The same contents will be present\Nin the feature branch, Dialogue: 0,0:01:20.72,0:01:23.50,Default,,0000,0000,0000,,but without the complication of the merge, Dialogue: 0,0:01:23.76,0:01:26.97,Default,,0000,0000,0000,,going into that feature branch,\Nand recorded in its history. Dialogue: 0,0:01:29.88,0:01:32.12,Default,,0000,0000,0000,,It's important to note\Nthat the {\i1}rebase{\i0} command Dialogue: 0,0:01:32.27,0:01:35.16,Default,,0000,0000,0000,,is altering all of the commits\Npresent in the branch. Dialogue: 0,0:01:35.55,0:01:37.80,Default,,0000,0000,0000,,It's preserving all of the work you did, Dialogue: 0,0:01:38.06,0:01:41.20,Default,,0000,0000,0000,,but their location and relationship\Nto other commits Dialogue: 0,0:01:41.20,0:01:42.58,Default,,0000,0000,0000,,is all changing. Dialogue: 0,0:01:43.08,0:01:46.48,Default,,0000,0000,0000,,This is primarily used for a branch\Nthat {\i1}you only{\i0} own, Dialogue: 0,0:01:46.48,0:01:48.64,Default,,0000,0000,0000,,and isn't being worked on by others. Dialogue: 0,0:01:48.97,0:01:50.24,Default,,0000,0000,0000,,The change in the relationship, Dialogue: 0,0:01:50.24,0:01:52.32,Default,,0000,0000,0000,,and identifier for each of those commits, Dialogue: 0,0:01:52.32,0:01:55.38,Default,,0000,0000,0000,,makes it difficult to reconcile\Nwith the work of others. Dialogue: 0,0:01:55.57,0:02:00.04,Default,,0000,0000,0000,,We're primarily talking about a branch\Nthat {\i1}you{\i0} are focused on. Dialogue: 0,0:02:00.49,0:02:04.06,Default,,0000,0000,0000,,But with those constraints in place,\Nthe use is quite simple. Dialogue: 0,0:02:04.47,0:02:07.17,Default,,0000,0000,0000,,{\i1}git checkout{\i0} to the feature branch, Dialogue: 0,0:02:07.65,0:02:12.44,Default,,0000,0000,0000,,{\i1}git rebase{\i0} on the source branch,\Ntypically {\i1}master{\i0}. Dialogue: 0,0:02:13.23,0:02:15.98,Default,,0000,0000,0000,,That will then iteratively walk through\Nall of the commits Dialogue: 0,0:02:15.98,0:02:17.98,Default,,0000,0000,0000,,that have happened on the feature branch, Dialogue: 0,0:02:17.98,0:02:22.80,Default,,0000,0000,0000,,and replay them as if they were being\Nrobotically rewritten, Dialogue: 0,0:02:23.10,0:02:27.59,Default,,0000,0000,0000,,starting from the latest point in time\Non the master branch. Dialogue: 0,0:02:27.89,0:02:29.56,Default,,0000,0000,0000,,When the process completes, Dialogue: 0,0:02:29.77,0:02:32.86,Default,,0000,0000,0000,,after seeing it step through\Nall of the individual commits, Dialogue: 0,0:02:33.39,0:02:36.31,Default,,0000,0000,0000,,it will let you know that\Nthe {\i1}rebase{\i0} is complete, Dialogue: 0,0:02:36.31,0:02:37.90,Default,,0000,0000,0000,,and you'll return to the command prompt Dialogue: 0,0:02:37.90,0:02:40.17,Default,,0000,0000,0000,,and what appears to be a similar state Dialogue: 0,0:02:40.17,0:02:42.33,Default,,0000,0000,0000,,to before you ran that instruction. Dialogue: 0,0:02:42.60,0:02:47.15,Default,,0000,0000,0000,,However, all of those historical commits\Nnow have new identifiers, Dialogue: 0,0:02:47.44,0:02:48.60,Default,,0000,0000,0000,,keep that in mind. Dialogue: 0,0:02:48.71,0:02:50.90,Default,,0000,0000,0000,,You'll find a request to use this pattern Dialogue: 0,0:02:50.90,0:02:53.13,Default,,0000,0000,0000,,is most common in open source projects. Dialogue: 0,0:02:53.66,0:02:55.94,Default,,0000,0000,0000,,It's because they want to optimize Dialogue: 0,0:02:55.94,0:02:57.83,Default,,0000,0000,0000,,for future readership of the code base. Dialogue: 0,0:02:58.14,0:03:01.90,Default,,0000,0000,0000,,A single straight line of history\Nprovides the easiest reading Dialogue: 0,0:03:02.08,0:03:04.50,Default,,0000,0000,0000,,for a future contributor to this project. Dialogue: 0,0:03:04.75,0:03:06.93,Default,,0000,0000,0000,,This is why they put the burden\Non the contributors, Dialogue: 0,0:03:06.93,0:03:08.60,Default,,0000,0000,0000,,to make the history clean. Dialogue: 0,0:03:08.100,0:03:11.15,Default,,0000,0000,0000,,It's an effort, but one that benefits Dialogue: 0,0:03:11.15,0:03:14.18,Default,,0000,0000,0000,,{\i1}every{\i0} future collaborator on this project. Dialogue: 0,0:03:16.80,0:03:18.94,Default,,0000,0000,0000,,Continuously delivered applications, Dialogue: 0,0:03:18.94,0:03:21.39,Default,,0000,0000,0000,,such as web services, and web apps, Dialogue: 0,0:03:21.92,0:03:25.88,Default,,0000,0000,0000,,are optimized, generally,\Nfor merges, not {\i1}rebase{\i0}. Dialogue: 0,0:03:26.45,0:03:29.24,Default,,0000,0000,0000,,They want the quickest possible\Ndelivery mechanism Dialogue: 0,0:03:29.48,0:03:33.39,Default,,0000,0000,0000,,to send a change, small and focused,\Ninto the master branch. Dialogue: 0,0:03:33.88,0:03:36.09,Default,,0000,0000,0000,,If that doesn't do\Neverything that it should, Dialogue: 0,0:03:36.48,0:03:39.86,Default,,0000,0000,0000,,another branch is worked on,\Nand merged back in again. Dialogue: 0,0:03:40.26,0:03:41.90,Default,,0000,0000,0000,,{\i1}Rebase{\i0} is a powerful feature Dialogue: 0,0:03:41.90,0:03:44.05,Default,,0000,0000,0000,,that lets you optimize\Nfor clarity of history. Dialogue: 0,0:03:44.37,0:03:47.23,Default,,0000,0000,0000,,Just bear in mind the needs\Nof your project and your team. Dialogue: 0,0:03:47.72,0:03:50.32,Default,,0000,0000,0000,,If it is for quick delivery\Nof feature branches, Dialogue: 0,0:03:50.32,0:03:51.64,Default,,0000,0000,0000,,just merge them in. Dialogue: 0,0:03:51.91,0:03:54.100,Default,,0000,0000,0000,,If it's for clarity of history,\Nengage in using {\i1}Rebase{\i0}. Dialogue: 0,0:03:57.17,0:03:58.98,Default,,0000,0000,0000,,Thanks for watching this\NGit & GitHub Foundations Dialogue: 0,0:03:58.98,0:04:00.43,Default,,0000,0000,0000,,episode on {\i1}Rebase{\i0}. Dialogue: 0,0:04:00.56,0:04:02.59,Default,,0000,0000,0000,,Be sure to subscribe\Nto our channel, over here, Dialogue: 0,0:04:02.59,0:04:05.36,Default,,0000,0000,0000,,ask us questions or comments\Nin the box below, Dialogue: 0,0:04:05.36,0:04:08.70,Default,,0000,0000,0000,,or watch one of the related episodes,\Nsuch as on creating a branch.