Difference between revisions of "Git/C2/Merging-and-Deleting-branches/English-timed"
From Script | Spoken-Tutorial
PoojaMoolya (Talk | contribs) (Created page with " {| Border=1 | <center>Time</center> | <center>Narration</center> |- | 00:01 | Welcome to the spoken tutorial on''' Merging and deleting branches'''. |- | 00:06 | In t...") |
Sandhya.np14 (Talk | contribs) |
||
Line 6: | Line 6: | ||
|- | |- | ||
| 00:01 | | 00:01 | ||
− | | Welcome to the spoken tutorial on''' Merging and deleting branches'''. | + | | Welcome to the '''spoken tutorial''' on''' Merging and deleting branches'''. |
|- | |- | ||
| 00:06 | | 00:06 | ||
− | | In this tutorial, we will learn about ''Merging''' | + | | In this tutorial, we will learn about '''Merging''', |
|- | |- | ||
| 00:10 | | 00:10 | ||
− | | | + | | revert '''merging''' and deleting '''branches'''. |
|- | |- | ||
|00:14 | |00:14 | ||
− | |For this tutorial, I am using '''Ubuntu Linux 14.04''' | + | |For this tutorial, I am using: '''Ubuntu Linux 14.04''' |
|- | |- | ||
|00:20 | |00:20 | ||
− | |'''Git 2.3.2''' and '''gedit Text Editor''' | + | |'''Git 2.3.2''' and '''gedit Text Editor'''. |
|- | |- | ||
|00:26 | |00:26 | ||
− | |You can use any editor of your choice. | + | |You can use any '''editor''' of your choice. |
|- | |- | ||
| 00:29 | | 00:29 | ||
− | | To follow this tutorial you must have knowledge of basics of''' Git''' commands and''' branching '''in '''Git'''. | + | | To follow this tutorial, you must have knowledge of basics of''' Git''' commands and''' branching '''in '''Git'''. |
|- | |- | ||
Line 46: | Line 46: | ||
|- | |- | ||
| 00:51 | | 00:51 | ||
− | | This diagram illustrates how the | + | | This diagram illustrates how the "new-module" '''branch''' is merged with the "master" branch. |
|- | |- | ||
Line 70: | Line 70: | ||
|- | |- | ||
| 01:20 | | 01:20 | ||
− | | To go into our''' Git repository''', type''' cd space mywebpage'''and press''' Enter'''. | + | | To go into our''' Git repository''', type:''' cd space mywebpage'''and press''' Enter'''. |
|- | |- | ||
Line 94: | Line 94: | ||
|- | |- | ||
| 01:57 | | 01:57 | ||
− | | The''' new-chapter | + | | The''' new-chapter''' branch was created earlier in this series and''' master''' is the default branch. |
|- | |- | ||
| 02:05 | | 02:05 | ||
− | | Currently, we are in the''' master | + | | Currently, we are in the''' master''' branch. |
|- | |- | ||
| 02:08 | | 02:08 | ||
− | | We will check the''' Git log''' by typing''' git space log space hyphen hyphen oneline''' | + | | We will check the''' Git log''' by typing''' git space log space hyphen hyphen oneline'''. |
|- | |- | ||
Line 110: | Line 110: | ||
|- | |- | ||
| 02:21 | | 02:21 | ||
− | | Type''' git space checkout space new-chapter''' | + | | Type:''' git space checkout space new-chapter''' |
|- | |- | ||
| 02:27 | | 02:27 | ||
− | | Type''' git space log space hyphen hyphen oneline''' | + | | Type:''' git space log space hyphen hyphen oneline''' |
|- | |- | ||
| 02:33 | | 02:33 | ||
− | | Now we will compare the '''commits''' of''' master''' and''' new-chapter | + | | Now, we will compare the '''commits''' of''' master''' and''' new-chapter''' branches. |
|- | |- | ||
| 02:38 | | 02:38 | ||
− | | These four '''commits''' are common to both the | + | | These four '''commits''' are common to both the branches. |
|- | |- | ||
| 02:42 | | 02:42 | ||
− | | | + | |"Added story.html in new-chapter branch" is in''' new-chapter''' branch. |
|- | |- | ||
| 02:48 | | 02:48 | ||
− | |And | + | |And, "Added chapter two in history.html" is in''' master''' branch. |
|- | |- | ||
| 02:54 | | 02:54 | ||
− | | After ''' | + | | After merging, '''“Added story.html in new-chapter branch” commit '''will be added in the''' master branch'''. |
|- | |- | ||
Line 142: | Line 142: | ||
|- | |- | ||
| 03:05 | | 03:05 | ||
− | | Type''' git space merge space master''' | + | | Type:''' git space merge space master''' |
|- | |- | ||
| 03:09 | | 03:09 | ||
− | | '''Gedit''' opens up automatically to receive the '''commit''' | + | | '''Gedit''' opens up automatically to receive the '''commit message'''. |
|- | |- | ||
| 03:14 | | 03:14 | ||
| Recall that we have configured''' gedit''' as the core '''editor''' of''' Git'''. | | Recall that we have configured''' gedit''' as the core '''editor''' of''' Git'''. | ||
− | |||
|- | |- | ||
Line 167: | Line 166: | ||
|- | |- | ||
| 03:36 | | 03:36 | ||
− | | I use the default '''commit ''' | + | | I use the default '''commit message''' as it is. |
|- | |- | ||
| 03:40 | | 03:40 | ||
− | | If you want to give any other message related to the '''merging''' | + | | If you want to give any other message related to the '''merging''' then type it here. |
|- | |- | ||
| 03:46 | | 03:46 | ||
− | | Now save and close the''' editor'''. | + | | Now '''save''' and close the''' editor'''. |
|- | |- | ||
Line 183: | Line 182: | ||
|- | |- | ||
| 03:54 | | 03:54 | ||
− | | You can see that the '''commits '''of''' master | + | | You can see that the '''commits '''of''' master''' branch are merged with''' new-chapter''' branch. |
|- | |- | ||
Line 195: | Line 194: | ||
|- | |- | ||
| 04:09 | | 04:09 | ||
− | | Type''' git space checkout space master''' | + | | Type:''' git space checkout space master''' |
|- | |- | ||
Line 203: | Line 202: | ||
|- | |- | ||
| 04:17 | | 04:17 | ||
− | | Here we should have seen '''master branch commits''' along with '''new-chapter commits'''. | + | | Here, we should have seen '''master branch commits''' along with '''new-chapter commits'''. |
|- | |- | ||
| 04:22 | | 04:22 | ||
− | |But the '''Git log '''shows '''master branch commits '''only. | + | |But, the '''Git log '''shows '''master branch commits '''only. |
|- | |- | ||
| 04:27 | | 04:27 | ||
− | | Ideally, we should have | + | | Ideally, we should have merged the''' new-chapter''' branch to the''' master''' branch. |
|- | |- | ||
Line 219: | Line 218: | ||
|- | |- | ||
| 04:36 | | 04:36 | ||
− | |That’s why we can't see the '''merging commit '''in the''' master | + | |That’s why we can't see the '''merging commit '''in the''' master''' branch. |
|- | |- | ||
Line 227: | Line 226: | ||
|- | |- | ||
| 04:45 | | 04:45 | ||
− | | For this, we will have to go back to the''' new-chapter | + | | For this, we will have to go back to the''' new-chapter''' branch. |
|- | |- | ||
| 04:50 | | 04:50 | ||
− | | Type''' git space checkout space new-chapter''' | + | | Type:''' git space checkout space new-chapter''' |
|- | |- | ||
| 04:54 | | 04:54 | ||
− | | To revert the '''merge''', type''' git space reset space hyphen hyphen hard space HEAD tilde''' | + | | To revert the '''merge''', type:''' git space reset space hyphen hyphen hard space HEAD tilde''' |
|- | |- | ||
Line 243: | Line 242: | ||
|- | |- | ||
| 05:12 | | 05:12 | ||
− | |So we have used '''HEAD tilde''' to get the previous revision of '''merging'''. | + | |So, we have used '''HEAD tilde''' to get the previous revision of '''merging'''. |
|- | |- | ||
Line 255: | Line 254: | ||
|- | |- | ||
| 05:26 | | 05:26 | ||
− | | We will now '''merge''' the''' new-chapter | + | | We will now '''merge''' the''' new-chapter''' branch to the''' master''' branch. |
|- | |- | ||
| 05:31 | | 05:31 | ||
− | | We will go to '''master | + | | We will go to '''master''' branch first by typing''' git space checkout space master''' |
|- | |- | ||
Line 267: | Line 266: | ||
|- | |- | ||
| 05:42 | | 05:42 | ||
− | | To '''merge''', we will type''' git space merge space new-chapter''' | + | | To '''merge''', we will type:''' git space merge space new-chapter'''. |
|- | |- | ||
| 05:48 | | 05:48 | ||
− | |Give your '''merging commit''' | + | |Give your '''merging commit message''' in the '''gedit'''. |
|- | |- | ||
| 05:52 | | 05:52 | ||
− | |Then save and close the''' editor.''' | + | |Then '''save''' and close the''' editor.''' |
|- | |- | ||
| 05:55 | | 05:55 | ||
− | | Again check the''' Git log'''. | + | | Again, check the''' Git log'''. |
|- | |- | ||
| 05:58 | | 05:58 | ||
− | | We can see that our''' new-chapter | + | | We can see that our''' new-chapter''' branch has been successfully merged to''' '''the '''master''' branch. |
|- | |- | ||
Line 291: | Line 290: | ||
|- | |- | ||
| 06:08 | | 06:08 | ||
− | |Type '''git space merge space new-chapter''' | + | |Type: '''git space merge space new-chapter''' |
|- | |- | ||
| 06:13 | | 06:13 | ||
− | | Now we see a message that says | + | | Now, we see a message that says “Already up-to-date”. |
|- | |- | ||
| 06:17 | | 06:17 | ||
− | |This is a good way to verify whether we | + | |This is a good way to verify whether we merged or not. |
|- | |- | ||
| 06:22 | | 06:22 | ||
− | | After '''merging, '''the''' new-chapter | + | | After '''merging, '''the''' new-chapter''' branch can be deleted from the''' Git repository.''' |
|- | |- | ||
| 06:28 | | 06:28 | ||
− | | To delete the | + | | To delete the branch, type:''' git space branch space hyphen d space new-chapter''' |
|- | |- | ||
| 06:36 | | 06:36 | ||
− | | Let’s check the '''branch''' | + | | Let’s check the '''branch list''' once again by typing''' git space branch''' |
|- | |- | ||
| 06:43 | | 06:43 | ||
− | |We can't see''' new-chapter | + | |We can't see''' new-chapter''' branch anymore as it has been deleted. |
|- | |- | ||
| 06:48 | | 06:48 | ||
− | | To delete a | + | | To delete a branch without '''merging''', use''' hyphen D''' in uppercase instead of '''hyphen d '''in lowercase. |
|- | |- | ||
Line 331: | Line 330: | ||
|- | |- | ||
| 07:02 | | 07:02 | ||
− | |In this tutorial, we have learnt about '''Merging''' | + | |In this tutorial, we have learnt about '''Merging''', revert '''merging '''and deleting '''branches'''. |
|- | |- | ||
| 07:09 | | 07:09 | ||
− | |As an assignment check the '''commits''' of the '''branch chapter-two''' which we created in the previous assignment | + | |As an assignment, check the '''commits''' of the '''branch chapter-two''' which we created in the previous assignment. |
|- | |- | ||
| 07:16 | | 07:16 | ||
− | |Merge it with the''' master branch '''and delete the''' chapter-two''' branch | + | |Merge it with the''' master branch '''and delete the''' chapter-two''' branch. |
|- | |- | ||
| 07:22 | | 07:22 | ||
− | | The video at the following link | + | | The video at the following link summarizes the Spoken Tutorial project. |
|- | |- | ||
Line 351: | Line 350: | ||
|- | |- | ||
| 07:30 | | 07:30 | ||
− | | The Spoken Tutorial Project | + | | The Spoken Tutorial Project team conducts workshops and gives certificates to those who pass online tests. |
|- | |- | ||
Line 363: | Line 362: | ||
|- | |- | ||
| 07:48 | | 07:48 | ||
− | | More information on this | + | | More information on this mission is available at the following link. |
|- | |- | ||
| 07:53 | | 07:53 | ||
− | | This is Priya from IIT Bombay. Thanks for joining. | + | | This is Priya from '''IIT Bombay'''. Thanks for joining. |
|} | |} |
Revision as of 14:35, 13 April 2016
|
|
00:01 | Welcome to the spoken tutorial on Merging and deleting branches. |
00:06 | In this tutorial, we will learn about Merging, |
00:10 | revert merging and deleting branches. |
00:14 | For this tutorial, I am using: Ubuntu Linux 14.04 |
00:20 | Git 2.3.2 and gedit Text Editor. |
00:26 | You can use any editor of your choice. |
00:29 | To follow this tutorial, you must have knowledge of basics of Git commands and branching in Git. |
00:37 | If not, for relevant Linux tutorials, please visit our website. |
00:42 | Earlier in the series, we learnt to create branches. |
00:47 | Now, we will learn how to merge two branches. |
00:51 | This diagram illustrates how the "new-module" branch is merged with the "master" branch. |
00:58 | This is done in the C9 commit. |
01:01 | After merging, the commits of new-module are added to master branch. |
01:06 | Let me explain how it works. |
01:09 | First, we will open our Git repository mywebpage which we created earlier. |
01:16 | Press Ctrl+Alt+T to open the terminal. |
01:20 | To go into our Git repository, type: cd space mywebpageand press Enter. |
01:29 | I will continue to use html files for demonstration. |
01:33 | You may use any file type of your choice. |
01:38 | From here onwards, please remember to press the Enter key after typing every command on the terminal. |
01:45 | Let us check the git branch list by typing git space branch. |
01:51 | We can see that we have two branches named master and new-chapter. |
01:57 | The new-chapter branch was created earlier in this series and master is the default branch. |
02:05 | Currently, we are in the master branch. |
02:08 | We will check the Git log by typing git space log space hyphen hyphen oneline. |
02:17 | Let’s go to new-chapter branch and check the Git log. |
02:21 | Type: git space checkout space new-chapter |
02:27 | Type: git space log space hyphen hyphen oneline |
02:33 | Now, we will compare the commits of master and new-chapter branches. |
02:38 | These four commits are common to both the branches. |
02:42 | "Added story.html in new-chapter branch" is in new-chapter branch. |
02:48 | And, "Added chapter two in history.html" is in master branch. |
02:54 | After merging, “Added story.html in new-chapter branch” commit will be added in the master branch. |
03:02 | Let me demonstrate how to merge now. |
03:05 | Type: git space merge space master |
03:09 | Gedit opens up automatically to receive the commit message. |
03:14 | Recall that we have configured gedit as the core editor of Git. |
03:20 | If you had configured another editor, then that one will open up. |
03:26 | If you are using a Git version that is below 1.9, then the editor may not open. |
03:33 | So, you may skip the next step. |
03:36 | I use the default commit message as it is. |
03:40 | If you want to give any other message related to the merging then type it here. |
03:46 | Now save and close the editor. |
03:50 | We will check the Git log again. |
03:54 | You can see that the commits of master branch are merged with new-chapter branch. |
04:00 | You can also see a commit message for the merging. |
04:04 | Next, we will go to master branch and check the commits. |
04:09 | Type: git space checkout space master |
04:14 | Let’s check the Git log. |
04:17 | Here, we should have seen master branch commits along with new-chapter commits. |
04:22 | But, the Git log shows master branch commits only. |
04:27 | Ideally, we should have merged the new-chapter branch to the master branch. |
04:32 | But we have merged it the other way around. |
04:36 | That’s why we can't see the merging commit in the master branch. |
04:41 | So, how can we revert this merging? |
04:45 | For this, we will have to go back to the new-chapter branch. |
04:50 | Type: git space checkout space new-chapter |
04:54 | To revert the merge, type: git space reset space hyphen hyphen hard space HEAD tilde |
05:04 | Recall that latest revision is always HEAD and latest minus 1 revision is always HEAD tilde. |
05:12 | So, we have used HEAD tilde to get the previous revision of merging. |
05:18 | Let’s check the Git log once again. |
05:22 | We can see that the merging is discarded now. |
05:26 | We will now merge the new-chapter branch to the master branch. |
05:31 | We will go to master branch first by typing git space checkout space master |
05:38 | Let’s check the Git log again. |
05:42 | To merge, we will type: git space merge space new-chapter. |
05:48 | Give your merging commit message in the gedit. |
05:52 | Then save and close the editor. |
05:55 | Again, check the Git log. |
05:58 | We can see that our new-chapter branch has been successfully merged to the master branch. |
06:05 | Let’s try to merge it again. |
06:08 | Type: git space merge space new-chapter |
06:13 | Now, we see a message that says “Already up-to-date”. |
06:17 | This is a good way to verify whether we merged or not. |
06:22 | After merging, the new-chapter branch can be deleted from the Git repository. |
06:28 | To delete the branch, type: git space branch space hyphen d space new-chapter |
06:36 | Let’s check the branch list once again by typing git space branch |
06:43 | We can't see new-chapter branch anymore as it has been deleted. |
06:48 | To delete a branch without merging, use hyphen D in uppercase instead of hyphen d in lowercase. |
06:56 | With this, we come to the end of this tutorial. |
07:00 | Let us summarize. |
07:02 | In this tutorial, we have learnt about Merging, revert merging and deleting branches. |
07:09 | As an assignment, check the commits of the branch chapter-two which we created in the previous assignment. |
07:16 | Merge it with the master branch and delete the chapter-two branch. |
07:22 | The video at the following link summarizes the Spoken Tutorial project. |
07:27 | Please download and watch it. |
07:30 | The Spoken Tutorial Project team conducts workshops and gives certificates to those who pass online tests. |
07:38 | For more details, please write to us. |
07:41 | Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India. |
07:48 | More information on this mission is available at the following link. |
07:53 | This is Priya from IIT Bombay. Thanks for joining. |