Now that you have a local copy of the repository, let’s use the steps of GitHub Flow to make a change in your project. First we will create a branch.
- Within GitHub Desktop, click “Branch”, then click “New Branch”.
- In the
Namefield, type a meaningful name for your branch. Something like
add-index-pagewill work nicely.
- If you have been following the directions exactly, GitHub Desktop knows to create the new branch based on
masterbecause it is the branch you were checked out to when you clicked the “New Branch” option.
- GitHub Desktop will automatically create your new branch and switch you to it.
Tell me why
Reviewing the GitHub Flow
Remember, we used the GitHub Flow in Introduction to GitHub, and we use it again here!
The main steps of the GitHub workflow are:
- Create a branch (This section deals with this step.)
- Add commits
- Open a Pull Request
- Collaborate, and make more commits
- Merge the Pull Request
You learned how to create a branch in the Introduction course, too. But this time, we will do it in the local repository.
When you create a local branch, it will persist regardless of how you decide to work with your files.
Feel free to use your favorite text editor or IDE to work with your files. Rest assured that you will only be making changes on the branch you have selected.