Cloud Computing

GitHub for Windows - Branches, Pull Requests, and Conflicts


In today’s Ask the Admin, I’ll show you how to add branches to GitHub repos, create pull requests and deal with merge conflicts.

In GitHub for Windows – Installation, Adding Accounts, Committing Changes, and Syncing Repos on Petri IT Knowledgebase, I looked at the basics of working with repositories and GitHub’s desktop app. Today, I want to dig a little deeper and show you how to work with branches, generate pull requests to merge changes into the master branch, and resolve conflicts when collaborating with colleagues.

Resolving Conflicts

When you add collaborators to a repo, you give them permission to upload files to the server, and this sometimes results in two or more users making changes to code that results in conflicts during a sync operation. Good teamwork can help reduce the number of conflicts, but inevitably they will sometimes occur.

Sponsored Content

What is “Inside Microsoft Teams”?

“Inside Microsoft Teams” is a webcast series, now in Season 4 for IT pros hosted by Microsoft Product Manager, Stephen Rose. Stephen & his guests comprised of customers, partners, and real-world experts share best practices of planning, deploying, adopting, managing, and securing Teams. You can watch any episode at your convenience, find resources, blogs, reviews of accessories certified for Teams, bonus clips, and information regarding upcoming live broadcasts. Our next episode, “Polaris Inc., and Microsoft Teams- Reinventing how we work and play” will be airing on Oct. 28th from 10-11am PST.

Resolving conflicts in GitHub for Windows (Image Credit: Russell Smith)
Resolving conflicts in GitHub for Windows (Image Credit: Russell Smith)

If a conflict is detected during a sync operation, you’ll need to resolve it manually, commit the files again, and then resync. Fortunately, GitHub for Windows displays conflicts directly in your files so that it’s easy to see where they’ve occurred and then remediate them.

Create a Branch

Probably you’ve noticed that by default you are working in the master branch. Branches are a key Git concept that enable workflow, and the master branch is always the final source code for your project that will be deployed.

Create a branch in GitHub for Windows (Image Credit: Russell Smith)
Create a branch in GitHub for Windows (Image Credit: Russell Smith)

But it may be that you, or one of the repo’s approved collaborators, is working on a feature that needs testing, and this code shouldn’t be deployed to the master branch while it’s in development. Only once the code has been fully tested and approved, should it be merged with the master.

New branches are created off the master and should be named to reflect their purpose. For instance, 2factor-auth if the feature being worked on is to add two-factor authentication to your script or app.

Let’s create a new branch in GitHub for Windows.

  • Open GitHub for Windows and select the repo you want to work with in the list on the left.
  • At the top of the app, you’ll see that you’re currently working in the master branch. Click the icon to the left of the branch menu, give the new branch a name, make sure in the From branch menu that master is selected, and then click Create new branch.
  • GitHub for Windows will now switch to the new branch.

Changes you make to files in the local clone of the repository can now be committed to either the master or 2factor-auth branch. If you click Publish in the top right of the GitHub for Windows, the new branch will be published in GitHub for others to access. After which point, you can click Sync to upload any further changes to the server.

Create a Pull Request

Now that you’ve got a new branch uploaded to GitHub, you’ll probably want other repo collaborators to review or work with you on the code before it gets merged into the master branch. Pull requests notify collaborators about the new code and asks them to review the commits and differences between the branch and the master.

Send a pull request in GitHub for Windows (Image Credit: Russell Smith)
Send a pull request in GitHub for Windows (Image Credit: Russell Smith)
  • In the top right of GitHub for Windows, click Pull Request.
  • In the Pull request panel in the right of the app, give the request a name, optional description and then click Send pull request. Note that any uncommitted changes in the current branch will be committed on sending the pull request.
  • If you want to see the request in GitHub, click the View it on GitHub link.
Review a pull request in GitHub (Image Credit: Russell Smith)
Review a pull request in GitHub (Image Credit: Russell Smith)

Pull requests can’t be reviewed directly in GitHub for Windows, but you can click on the pull requests icon in the top right of the app to view pull requests on If there are no conflicts with the master branch, you can merge the changes into the master by clicking Merge pull request on the pull request page in GitHub. Once you merge a pull request with the master, the request and sub branch are automatically deleted.

Related Topics:


Don't have a login but want to join the conversation? Sign up for a Petri Account

Comments (0)

Leave a Reply

IT consultant, Contributing Editor @PetriFeed, and trainer @Pluralsight. All about Microsoft, Office 365, Azure, and Windows Server.
External Sharing and Guest User Access in Microsoft 365 and Teams

This eBook will dive into policy considerations you need to make when creating and managing guest user access to your Teams network, as well as the different layers of guest access and the common challenges that accompany a more complicated Microsoft 365 infrastructure.

You will learn:

  • Who should be allowed to be invited as a guest?
  • What type of guests should be able to access files in SharePoint and OneDrive?
  • How should guests be offboarded?
  • How should you determine who has access to sensitive information in your environment?

Sponsored by: