【My Study Note】Branches
Branches

Why you need to create a branches?
チームで作業をする際、特に近いFeartureを複数人で作業する際に、Branchを使うことで、整理整頓できる。また、これを使うことでPeer Reviewを受けることができる。つまり、メインのブランチのコードとMergeする前に、他のチームメンバーからその変更は正しいかどうかのチェックを受けることができる。
Create a Branch
git checksum -B 'feature/lesson'
To create a new branch, you can use the git checkout command by typing git checkout dash b. In this case, I call this new branch “feature/lesson”.
You can also use this
git branch 'feature/lesson'
These 2 methods are the same and can both be used to create a branch. The key difference between them is that git branch just creates a branch. But git checkout dash B moves you from the main branch into the branch that you created.
How to verify your current branch
git branch
Any changed that you would make only occur in this current branch.
When you’re using the new created branches, it’s important to remember that the main branch has no indication or knowledge of any of these changes even when I push code to the main repository, this is because that branch exists in isolation.
Pull Request
The purpose of a pull request is to obtain a peer review of changes made to the branch. In other words, to validate that the changes are correct when coding, many teams will have conditions around the unit tests and integration tests.
These conditions will usually include validating that the standards have been met for merging back into the main line, a team will also check for any issues that might have been missed.
Push
git push- u origin feature/lesson
Dash U means that you’re only going to get updates from the upstream, which in this case will be the main branch. The result of this is that the origin won’t be my main branch anymore. Instead, it’s a feature lesson.
Forking
Forking is another type of workflow. The key difference between branching and forking is that the workflow for forking creates a new repository entirely. Branching cuts a new branch from the same repository each time and each member of the team works on the single repository.