...

Open source softwares - GIT

Back to Course

Lesson Description


Lession - #1145 Git Branch


The git branch command allows you to create, list, rename, and delete branches. It does not allow you to switch between branches or put a forked history back along again. For this reason, git branch is tightly integrated with the git checkout and git merge commands.



How do I create a new branch in Git?
The git branch command may be used to create a new branch. after you need to start a new feature, you create a new branch off main using git branch new_branch . Once created you'll then use git checkout new_branch to switch to that branch.

Example

git branch hello-world-images


Now we created a new branch referred to as "hello-world-images"

Let's make sure that we've got created a new branch:

Example

git branch
hello-world-images
* master


We can see the new branch with the name "hello-world-images", however the * beside master specifies that we are presently on that branch.