2  Understanding branches

Key Terms

branch - a space for making changes to code without affecting the original code merge - merge the commits on two branches merge conflict - a problem when there are two incompatible versions of a file that you are trying to merge main - conventional name of the default branch of your repo

2.1 Why branches are useful

A branch lets you develop code, fix a problem, or test an idea without affecting the original project. A branch is created from an existing branch, usually from the main branch of the project. You can work on a branch, bravely develop code that works or does not work and it does not break the code on the main branch. Basically, you can experiment on your own.

  • Creating dev versions of your work
  • Allow collaborators to make and propose changes (more in next section)
  • Provide a space to work on issues/patches

Note that main branch was previously named master branch, but removed because of the reference to slavery. Because of this change you might find references to the old name when looking for help elsewhere.

2.2 The basics of branching.

A repository that has three branches alongside the main branch. Not that the changes that are happening on the different branches are complete independent. Not shown here (but will in a future version) but it is possible to update branches to include changes that have happened on main.

2.3 Troubleshooting

References