Creating a branch in Github Desktop client is simple, but I have seen quite a few people struggling with it when it comes to merging the branches. This article focuses on how you can do that easily. The images should help you understand the process. If you already know how to create a project and branches you can jump straight to Step 7.2.

Ensure that you have installed Github Desktop Client before proceeding.

Step 1: Create a blank project

Give an appropriate name & location for the repository and click Create Repository.
Create a blank project

Step 2: Create content

Create a text file for simplicity and add some text so you have something to commit on the main branch. Click Commit and Sync master so that the changes are synced to the server.
Create a text file

Step 3: Publish Repository

Your local repository is ready for publishing. Hit the Publish Repository button.
Publish Repository

Step 4: Create Feature branch

Click on the Create New Branch button and name the feature. Hit Create Branch.
Create Branch

Step 5: Change content

Make some changes in the content and the Github client will automatically pick it up. Click Commit and Sync feature-1 button. You can continue making changes to the feature till you think it is ready to be merged into the master branch.
Changes

Step 6: Create Pull Request

While you are in the feature branch, click on the Pull Request button. Notice that the master < feature-1 visualization shows clearly that you are merging your master branch from the feature-1 branch. Click Send Pull Request.

create pull request

Step 7: Merge Changes

If you look at your repository on Github.com portal, you will see a pull request.
pull request

Step 7.1

You can click on the Please pull feature 1 changes link and merge changes using the Portal. This is easy and most likely you already know it.
pull using web portal

Step 7.2

The same merge using the Desktop client is tricky but beneficial if you don't want to visit the portal. It is not difficult per se, but definitely not as intuitive! The following steps should help.

Step 7.2.1

Switch to the master branch.
Switch

Step 7.2.2

Tell Github to compare it with the feature branch. Click Compare button and pick the feature branch you want to pull from.
compare feature branch

Step 7.2.3

Click Update from feature-1 button. It seems like it will just update. But in the background, it updates and closes the pull request!
update

After the update, you can clearly see that changes are merged to the master branch.
merged

Step 7.2.5

Click Sync button and check the portal. Your pull request should be closed by now.
portal closed

You can now delete the branch from the menu: Branch > Delete feature-1.

What next?

Well, stay tuned for upcoming articles. Say hi, share this article, leave a comment or Subscribe now to stay updated through our newsletter. Also, check out our services or contact us at contact@attosol.com for your software and consultancy requirements.

Ads: