This part 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
There are 5 stages of the GitHub flow process; feel free to click on any of the jumplinks to go to the section you want, or just scroll down.
1. Create Branch
Simply navigate to the repository you want to work on, then click ‘New Branch’ to start the GitHub flow process. By creating a new branch, you can work on adding code to the main project without affecting the default branch.
2. Edit Branch
Here’s the fun part. You can add any file you want to your branch and then commit your changes once you’re done. Note that even committed changes through files will not affect the default branch until your branch is merged with the default.
Protip: each committed file should work on an independent change so that future developers looking at your code will save time on redundancies. After all, the whole purpose of the GitHub flow is to improve efficiency across teams.
On that note, to help your senior developers review your code, try to make sure that each file you add has a clear, descriptive message of what your code is trying to solve. Once you finish a part of your code, click ‘commit file’ to move on to the next part.
Continue working on your code until you are satisfied and ready to receive feedback.
3. Create a Pull Request
Now that your code is ready for review, it’s time to submit a Pull Request to receive feedback from your coworkers. Make things easier for anyone reviewing your work by summarizing the changes you’ve made along with what you’re trying to solve.
GitHub allows you to attach images, links, lists, and tables. Navigate to the branch that you want to create a pull request for and click ‘New pull request’.
This should bring you to a new page where you can add more details about your code, attach files, mention users, etc. Simply click ‘create pull request’ to open your branch up to feedback.
4. Merge Pull Requests
Assuming you’ve received feedback on your code and successfully acted upon it, it is time to merge your pull request, which merges your branch with the default branch and carries out any changes you’ve made. Depending on how the repository is set up, you may need action from a specific reviewer before being able to proceed.
As you can see below, GitHub will automatically check if you have any conflicts with the base branch. If everything is good to go, you can go ahead and click ‘Merge Pull Request’ and confirm the merge.
5. Delete Branch
Now that your branch has been merged with the default branch, all that’s left is to delete your branch. This cleans up your repository and prevents you or others from mistakenly using an old branch in the future.
GitHub gives you the option to delete your branch right after merging the pull request, so there’s no confusion.
Git Flow vs GitHub Flow
GitHub Flow arose as a more efficient way to work with your team as a successor to Git Flow. The Git Flow process is based on a release schedule, where your team releases many different features simultaneously.
In Git Flow, you have a main branch, a release branch, a develop branch, and a feature branch. The main branch is the master code; it’s already released and should not be worked on or edited. The develop branch is directly related to the main branch and is what your team will work on. Feature branches are where coders work individually.
Finally, the release branch is when the features of the develop branch are ready to be merged with the main branch. If all that’s confusing to you, don’t worry; here’s a helpful video that goes into more details about the differences between Git Flow and GitHub Flow
Using GitHub Flow as Your Team’s Workflow
Get started with the GitHub Flow process today and increase your team’s efficiency as soon as possible. These five easy steps can help your team improve cross-collaboration and make coding projects more straightforward than ever before.