Git Kata 2: Branches

Learn about listing, creating, and working with branches.

Branching is one of the most used and useful features of Git. Commits are always applied to a branch. Creating a new branch in a local repository starts a new commit history, starting from a specific commit in the source branch from which the new branch is created.

Branches are used to isolate work. New work, such as features and hotfixes, are created on a new local branch. These are referred to as feature or topic branches. Branches keep work organized and prevent new work from breaking existing work. Developers can create new local branches at will and commit changes to them. Branches can then be discarded or pushed to a remote server and merged into other branches.

Step 1: Listing and creating branches

The command to list all the branches is given below.

Get hands-on with 1200+ tech skills courses.