đź’»
How to Use Project Development Tools in a Remote C
  • How to Use Project Development Tools in a Remote Coding Team
  • Trello
    • Introduction to Trello
    • How to use Trello
      • What is Trello?
      • Starting up a Trello Board
      • Lists
      • Cards
  • Visual Studio Code
    • Introduction to Live Share in Visual Studio Code
    • How to use Live Share
      • How to Install
      • How to Use
      • Examples of Use Cases
  • Git & Github - Basics
    • Introduction to Git & GitHub
    • How To Use Git
      • Setting up Git
      • Creating GitHub Repositories
      • Managing Repository Access
      • Syncing with a Local Workspace
  • How to Manage a Codebase with Git
    • Introduction to Branching
    • How To Use Branches
      • What are Branches?
      • Working in Branches
      • Merging Branches
      • Best Practices For Branching
    • Git Codebase Management Cheat Sheet
  • Conclusion
  • Team Biography
  • References
Powered by GitBook
On this page
  • Branches
  • Merging

Was this helpful?

Export as PDF
  1. How to Manage a Codebase with Git
  2. How To Use Branches

What are Branches?

Before we begin, a more technical introduction to branching and merging is necessary to introduce some concepts, terminology, and conventions.

Branches

Branches are where code and revisions are committed and pushed to. In a repo, by default, any work done is done on the default “master” (sometimes called “main”) branch. New branches are created as copies of other “source” branches, that is, when a new branch is created from a source branch, everything – all files, content, and revision history - in the source branch is copied to the new branch. From then on, commits and changes are managed independently in both branches and do not affect each other, and developers can choose what branch to push their changes to. For example, if branch B is created from branch A, one can commit code to branch B, and nothing will change in the copy of the codebase stored in branch A.

Merging

Merging allows one to combine two branches, transferring the changes from a branch (again called the source branch) to another branch (called the destination branch). In doing this, all differences in revisions between the source and destination are committed to the destination branch. Sometimes, there are conflicts, where both branches made changes to the same code, in which case the user is required to resolve the conflicts in a so-called merge commit where the user picks what code from each branch should be incorporated (or writes their own code so that both sets of changes can work together).

PreviousHow To Use BranchesNextWorking in Branches

Last updated 4 years ago

Was this helpful?