0:00
/
0:00
Transcript

Git branches for wetlab scientists

Branches are arguably one of the most important features of git - they allow you to keep multiple histories of your repository at the same time. Start using them early and often!

Part 1 of this tutorial series can be found here.

Git branches are arguably the soul of git - keeping multiple states of a repository available at the same time. I didn’t actually use branches for the fist year or two of my git journey - they’re often only brought up in the context of collaboration - but I think they can be incredibly powerful even for solo use.

Commands

  • git branch: lists the branches in the repository

  • git branch <branch-name>: creates a new branch, but doesn’t check it out

  • git checkout <branch-name>: checks out an existing branch - won’t work if the branch doesn’t exist already

  • git checkout -b <branch-name>: creates AND checks out a branch - won’t work if the branch already exists

  • git branch -D <branch-name>: deletes a branch

  • git commit -am “Commit message”: stages and commits all files that have previously been tracked.

Discussion about this video

User's avatar

Ready for more?