GitHub - Working with Branches
Welcome to "GitHub: Working with Branches"
In this video, you will learn how to define a GitHub branch, create master and child branches, describe how to merge branches, and create a Pull Request.
Definition of a Branch
A branch is a snapshot of your repository where you can make changes. It acts as a copy of the master branch and is used for developing and testing workflow changes before merging them into the master branch.
Master Branch
The master branch is the main branch of your project, containing the deployable code. It is stable and should only contain tested code.
Creating Child Branches
To make changes to the code without affecting the master branch, you can create a child branch. This branch serves as a copy of the workflow where changes and experiments can be made. Once satisfied with the changes, they can be merged back into the master branch for deployment.
Creating Branches in GitHub
To create a branch in GitHub, navigate to the repository and click the drop-down arrow next to the branch selector. Then, create a new branch by providing a name, such as 'child branch'. The repository will now have two branches: master and child.
Adding Files to a Branch
Files can be added to a branch without affecting the master branch. Simply select the branch in the branch selector drop-down list and click "Create new file." Add the file name and content, then commit the changes with a descriptive message.
Merging Branches with Pull Requests
To merge changes from a child branch into the master branch, create a Pull Request (PR). A PR compares the differences between the branches and notifies team members of the changes. Once reviewed and approved, the changes can be merged into the master branch.
Conclusion
In summary, branches in GitHub allow for the isolation of changes and testing before merging into the master branch. Pull Requests facilitate collaboration by notifying team members of changes and providing a mechanism for review and approval before merging.
Comments
Post a Comment