From the course: Learning Software Version Control
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Git branching and merging
From the course: Learning Software Version Control
Git branching and merging
- [Instructor] In Git, we can use branching to create a new line of development separate from the main branch. Let's see how it works. Here I have a JavaScript class and I want to include a new feature. So I'm going to create a new branch with git branch, and let's called it newFeature. Now, I need to switch to the new branch with Ggit checkout and the name of the branch, newFeature. Hit Enter. I can include changes here, which only affect the main project once merged. For example, here I want to include a new method inside this class and a branch work exactly as the main trunk. We can save or revert changes. So to commit changes in this branch, let's type git add and git commit -m with a message, which is new feature. Now, this feature is only present on my new branch. Let's start merging the code. In case you need to know the name of your branches, you can type git branch -a. And as you can see, we have two…
Contents
-
-
-
-
How Git works2m 26s
-
(Locked)
Creating Git repositories2m 16s
-
(Locked)
Basic Git commands3m 23s
-
(Locked)
Reverting code to a previous version2m 7s
-
(Locked)
Git branching and merging2m 32s
-
(Locked)
GUI clients and IDE integration3m 17s
-
(Locked)
GitHub and other Git online services2m 22s
-
(Locked)
Challenge: Send one commit to a different branch58s
-
(Locked)
Solution: Send one commit to a different branch2m 25s
-
-
-
-
-
-