# Git Branches - Part 3

In our previous blog, we set up the GitHub repository and pushed it back into Github. We can see it briefly in the following images.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692333227512/5c1843fd-23cc-4734-b86b-fffcfc5e6f30.png align="center")

* Git status shows we are in the main branch and it's up to date.
    
* when we pushed the main branch, it also showed everything is timely.
    
* The Git branch shows we are currently in the **main** branch
    

Let's create a new branch and switch to the new branch called **"branch1"**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692334805960/6a759091-f72a-4e0d-adb9-e7e9f056ddf9.png align="center")

We can see the branches list and see we are currently in the main ( **\*** shows where we are currently). We used switch and checkout and commands to move from branch to branch. In the final command, we switched to a new branch "branch1"

Let's add some content in the new branch and push it to GitHub.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692335091335/81b53d42-2201-4f96-b784-ef50c5e19d39.png align="center")

Here, in the new branch, we created a text file hello.txt and added the content "Hello World".  
`git add hello.txt` command stages the changes that we made to the `hello.txt` file. Staging prepares the changes for the next commit.  
`git commit -m "hello world content added"the` command creates a commit to save the staged changes to the Git history. The `-m` flag allows you to provide a commit message that describes the changes. Here, the commit message is "Hello world content added."

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692335564416/0e68d5d4-88e6-4af8-bb6b-30a4562c2845.png align="center")

Finally, we pushed the update in the Github successfully which we can view the updates in the GitHub.

### Merging branches

We can now merge the branches to the main branch. Merging branches is a common operation in Git that combines the changes from one branch into another.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1692335729505/479218f1-ddf2-4b8f-b352-fdcd1d0ef7cd.png align="center")

We merged "branch1" into the main branch. To merge the branch to the main, first, we need to switch back to the main and perform the merging action.

Happy Learning!!!
