Now that you’ve merged
origin/master into your local
master branch, you’re ready to contribute some work of your own. The workflow for Git collaborations typically follows this order:
- Fetch and merge changes from the remote
- Create a branch to work on a new project feature
- Develop the feature on your branch and commit your work
- Fetch and merge from the remote again (in case new commits were made while you were working)
- Push your branch up to the remote for review
Steps 1 and 4 are a safeguard against merge conflicts, which occur when two branches contain file changes that cannot be merged with the
git merge command. Step 5 involves
git push, a command you will learn in the next exercise.
Enter this command:
to change directories into the my-quizzes directory.
Enter the Git command:
git branch <branch_name>
to create a branch to develop questions for the biology quiz. Name the branch
Note: be careful to spell the name “bio-questions” exactly as it appears.
Switch to your new branch with the command:
git checkout <branch_name>
<branch_name> with the name of the new branch.
On your branch, open the file biology.txt under the
my-quizzes folder in the code editor (make sure you are editing the correct biology.txt file).
Add a biology question to the file and some sample answers. For example:
What is an animal that hunts and eats other animals called? a) herbivore b) prey c) ecosystem d) predator
Add biology.txt to the staging area.
Commit the work to the repository with a commit message.