Skip to content

What is a Branch?

landin3thorsted edited this page May 18, 2020 · 5 revisions

While you're working on a project you will probably want to test something without affecting the code you already have. This is where a branch comes in handy, as they allow you to branch off and test out anything you are going to create.

Use:

Say there was a portion of code that works, but is slow or inefficient. You could use a create branch to work on that portion of code while keeping the original intact. If you couldn't figure out a better way, then you can just discard the branch. But, if you do find a better way, then you can create a "Pull Request" which will allow you, or someone else, to review the changes and pick one to go with.

Quick Summary

Scenario: Say you have code you want to edit, but you don't know if you'll want to keep the changes

Create a branch, write and test the new code

If you don't like the new code

  • Discard the branch

If you like the new code

  • Create a Pull Request to review the changes
    • Pick which one to keep

Longer Reading

https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-branches

Clone this wiki locally