Branchingis the way to work on different versions of a repository at one time.
By default your repository has one branch namedmasterwhich is considered to be the definitive branch. We use branches to experiment and make edits before committing them tomaster.
This diagram shows:
The master branch
A new branch called feature (because we’re doing ‘feature work’ on this branch)
The journey that feature takes before it’s merged into master
Have you ever saved different versions of a file? Something like:
story.txt
story-joe-edit.txt
story-joe-edit-reviewed.txt
Branches accomplish similar goals in GitHub repositories.
Here at GitHub, our developers, writers, and designers use branches for keeping bug fixes and feature work separate from ourmaster(production) branch. When a change is ready, they merge their branch into master.
Step:
1.Go to your new repositoryhello-world.
2.Click the drop down at the top of the file list that saysbranch: master.
3.Type a branch name,readme-edits, into the new branch text box.
4.Select the blueCreate branchbox or hit “Enter” on your keyboard.
网友评论