When I first started using Github to fork and clone my lab assignments at Flatiron School, I thought that I was slowly mastering “Git Flow”. It turns out that just because Github has the word “git” in it, does not mean it uses “Git Flow.” What I was beginning to learn was actually “Github Flow.” The main differences are that “Git Flow” is used for software utilizing the concept of “release,” while “Github Flow” uses continuous release. With “Github Flow” there aren’t really “releases” because we deploy to production all the time. Github.com describes “Github Flow” as “a lightweight, branch-based workflow that supports teams and projects where deployments are made regularly.” So how does it work?
- Create a project on Github and or clone a project to your local machine
2. Open the project folder in your terminal and run the command “git branch -a” to check how many branches you have and which branch is selected. Branches are an integral part of “Github Flow” and allow developers to create new features and try new ideas without affecting the “main branch.”
3. To create a new branch, run the command “git branch (name of branch)” It’s helpful to use a name that accurately describes the new branch/feature. These new branches won’t affect the “main branch,” as your new branch won’t be merged until after it gets reviewed. Lastly, use the command “git checkout (name of branch)” to switch to your newly created branch.
4. Now that you’re working on a new branch, you can start making changes and commits as you work on your new feature. Make sure to add messages to your commits using “git commit -m (“Message”). Writing descriptive messages will help others follow along and provide feedback to your work. As you work on your new branch, you should be continuously pushing your work. The first time you try to push your new branch you’ll need to type the command “git push — set-upstream origin (name of branch).”
5. Once you’ve finished working on the changes in your new branch, it’s time to create a pull request. A pull request is a comparison of your new branch and the main branch. Pull requests are an opportunity for people to review your code and make changes if necessary. Any changes made on your new branch after the pull request is made will update automatically.
6. After you’ve made your pull request and it has been reviewed and changed to your teams’ liking, it’s time to finally merge your new branch with the main branch. You can do this by navigating to the “Pull requests” section of your project on Github and pressing the “Merge pull request button.” Lastly you can navigate to branches on Github and delete your new branch if desired.
Github flow makes
Sources and Useful Links: