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 repositorygit branch <branch-name>: creates a new branch, but doesn’t check it outgit checkout <branch-name>: checks out an existing branch - won’t work if the branch doesn’t exist alreadygit checkout -b <branch-name>: creates AND checks out a branch - won’t work if the branch already existsgit branch -D <branch-name>: deletes a branchgit commit -am “Commit message”: stages and commits all files that have previously been tracked.




