Introduction
|
Challenges for sharing code include making sure everyone has access to the latest version, everyone can contribute equally, keeping organized, and making sure everyone has equal opportunity to contribute.
Branches and pull/merge requests provide mechanisms for individuals to work on the code independently and then integrate those changes into the main codebase.
Git workflows are used to stay organized and productive.
|
Branches
|
Branches allow team members to work on code without impacting the work of other developers or users
Create a new branch with the git checkout -b command, for example: git checkout -b my_branch
Change to another branch with the git checkout command, for example: git checkout my_other_branch
Merge my_branch into the current branch with with the git merge command, for example: git merge my_branch
Rebasing rewrites history and can sometimes be used instead of merge, where appropriate
Never rebase on a public branch
|
Pull Requests
|
A Pull Request is a GitHub a process to request that a branch be merged into another branch.
Pull requests provide a process and an opportunity for code review before merging branches and can be a mechanism for proposing, discussing, and requesting changes before the branch is merged.
|
Git Workflows
|
A git workflow describes how a team or group of contributors is to interact with a repository
Git workflows keep a team organized and on the same page by helping them understand what state the code is in
|