HubSpot by IV-Lead

GitHub Flow: A Quick 5-Step Process

Written by Ohad Peter | Jun 25, 2023 2:41:27 PM

It can be challenging for those unfamiliar with Git or GitHub to work with the tool. For this reason, Github offers a workflow that makes collaborating with your team easier.

What is GitHub Flow?

GitHub Flow is an established process by GitHub made to help streamline the process of developing within specific teams. GitHub’s workflow is set up so that there is one default branch that serves as the main project and individual branches where team members can work on adding new features without compromising the default branch. Within an overarching project, team members can work on individual branches. As soon as everything has been approved, you can merge your branch with the default one after receiving feedback from team members.

Setting Up

It may seem obvious, but you'll need a GitHub account before anything else. From there, you can either create a new repository or work out of a pre-existing project.

GitHub Flow Process

Feel free to click on any of the jumplinks to go to the section you want, or scroll down to see the whole GitHub flow process.

1. Create Branch

To begin the GitHub flow process, go to the repository you wish to work on, then click 'New Branch'. You can work on adding code to the main project without affecting the default branch by creating a new branch.

2. Edit Branch

Here’s the fun part. You can add any file you want to your branch and commit your changes once you're finished. Until your branch is merged with the default branch, even committed changes will not affect the default branch.

Whenever you commit a file, you should make a separate change so that future developers will save time on redundancies. The whole point of the GitHub flow is to improve efficiency across teams.

Please make sure each file you add has a clear, descriptive message explaining what your code is trying to accomplish. You can move on to the next part of your code by clicking 'commit file' once you have finished a part.

Work on your code until you are satisfied and ready to receive feedback.

3. Create a Pull Request

Your code is now ready for review, so submit a Pull Request to receive feedback from your colleagues. Describe the changes you've made along with the problem you're trying to solve for anyone reviewing your work.

You can attach images, links, lists, and tables to GitHub. Choose the branch for which you want to create a pull request and click 'New pull request'.

You'll be taken to a new page where you can add more details about your code, attach files, mention users, etc. Open up your branch for feedback by clicking 'create pull request'.

4. Merge Pull Requests

After you've received feedback on your code and acted on it, it's time to merge your pull request, which merges your branch with the default branch and carries out any changes you've made. You may need the approval of a specific reviewer, depending on how the repository is set up.

As you can see below, GitHub will automatically check for conflicts with the base branch. Click 'Merge Pull Request' and confirm the merge if everything looks good.

5. Delete Branch

The only thing left to do is to delete your branch once it has been merged with the default branch. It prevents you or others from accidentally using an old branch in the future.

So there's no confusion, GitHub gives you the option of deleting your branch after merging the pull request.

Git Flow vs GitHub Flow

As a successor to Git Flow, GitHub Flow provides a more efficient way to work with your team. It is based on a release schedule, where multiple features are released simultaneously under the Git Flow process.

There are four branches in Git Flow: the main branch, the release branch, the develop branch, and the feature branch. The main branch is the master code; it has already been released and should not be edited or worked on. Your team will work on the develop branch, which is directly related to the main branch. Individual coders work on feature branches.

The release branch is when the features of the develop branch are ready to be merged with the main branch. You don't have to worry if all that's confusing; here's a helpful video explaining the differences between Git Flow and GitHub Flow.

Getting started with branching workflows, Git Flow and GitHub Flow

Using GitHub Flow as Your Team’s Workflow

Start using GitHub Flow today to increase your team's efficiency. With these five simple steps, your team can improve cross-collaboration and make coding projects more straightforward.