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
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.
Step 3: Publish Repository
Your local repository is ready for publishing. Hit the
Publish Repository button.
Step 4: Create Feature branch
Click on the
Create New Branch button and name the feature. Hit
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.
Step 6: Create Pull Request
While you are in the feature branch, click on the
Pull Request button. Notice that the
feature-1 visualization shows clearly that you are merging your
master branch from the
feature-1 branch. Click
Send Pull Request.
Step 7: Merge Changes
If you look at your repository on Github.com portal, you will see a pull request.
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.
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.
Switch to the master branch.
Tell Github to compare it with the feature branch. Click
Compare button and pick the feature branch you want to pull from.
Update from feature-1 button. It seems like it will just update. But in the background, it updates and closes the pull request!
After the update, you can clearly see that changes are merged to the master branch.
Sync button and check the portal. Your pull request should be closed by now.
You can now delete the branch from the menu:
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 firstname.lastname@example.org for your software and consultancy requirements.