The Flow
As mentioned the GitHub flow is relatively lightweight. This is what it looks like in a nutshell:
- Create a new branch to implement the feature (or bugfix...).
- Implement the code and add commits to the branch.
- Push the code to the remote repository on GitHub.
- Open a Pull Request on GitHub.
- The code gets reviewed and discussed.
- Merge the branch to the
main
branch (akamaster
).
This may look very simple at first. But it can get quite complicated when used in a team. More on that on the next page.
For now, here's some lingo explanation:
- When you build a feature on a branch it is called feature branch.
- A Pull Request or PR is a place where your team can review and discuss the code changes.
- GitHub replaced the default
master
branch withmain
. Mental note: main = master
You can see a more interactive description of the GitHub flow here. I left out the Deploy step since it's different for every team and depends on their setup.
These are only 6 steps and only a couple of them require you to use Git yourself. The most basic Git commands you need are
git branch
to create a branchgit checkout
to switch branchesgit commit
to add changesgit push
to update the remote repositorygit pull
to sync your local repository with the remote
You don't even need to merge yourself in the command line since you'll simply press a button in the Pull Request.
By the way, no worries if you're not used to working on branches yet. You'll get there. But I hope you heard of most of these commands. Otherwise, make yourself familiar with a bit of research.
Note: Even though it's called GitHub flow you can use this flow on GitLab or BitBucket as well. The important thing is that you use Pull Requests to merge your code to the main branch (also called Merge Requests on GitLab)
Next: When it gets complicated