The first step in the GitHub Workflow is to create a branch. This will allow us to experiment with new features without accidentally introducing untested changes on our production branch.
When you create a branch, you are essentially creating an identical copy of the project at that point in time. This isn't the same as creating a physical copy on disk. In the background, a branch is just a pointer.
Let's learn how you can create a new branch.
Earlier you created an issue about the file you would like to edit. Let's create the branch you will use to edit your file.
Follow these steps to create a new branch in the class repository:
You will need to have collaborator access on the class repository before you can create a branch on GitHub.
- Navigate to Code tab of the class repository.
- Click the branch dropdown.
- Enter the branch name 'github-username-caption'.
When you create a new branch on GitHub, you are automatically switched to your branch. Now, any changes you make to the files in the repository will be applied to this new branch.
A word of caution. When you return to the repository or click the top level repository link, notice that GitHub automatically assumes you want to see the items on the default branch. If you want to continue working on a feature branch, you will need to reselect it using the branch dropdown.
Here are some interesting things you can check out later:
- https://youtu.be/H5GJfcp3p4Q A GitHub Training Video on branching.