Working with Git branches

Command Line – Git Branches

© Lead Image © Rachael Arnott, 123RF.com

© Lead Image © Rachael Arnott, 123RF.com

Article from Issue 243/2021
Author(s):

Git makes version control as simple as possible. To manage your Git branches successfully, you need to learn the ins and outs of git branch and git merge.

In a previous issue of Linux Magazine [1], I outlined how to set up a Git Repository (Table 1). Once a repo is set up, you are ready to use Git [2] for version control.

Version control in Git is about managing and creating branches (collections of files that are variations of each other). By making a branch, you can edit files without altering the original. Later, if you choose, you can merge branches to create a more advanced copy.

The process of managing branches is so simple that branches tend to proliferate in projects that use Git, with branches being created for different users, subsystems or hardware architectures, each release, experiments, or any other criteria that may useful. In fact, while other version control systems also use branches, using Git repos is so flexible that it is widely considered Git's defining feature. Two Git sub-commands are the main tools for managing branches: git branch [3], which sets up and edits branches, and git merge [4], which combines branches.

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Remote Git Repositories

    Software projects often comprise several code branches, some of which exist in parallel. Git supports community code development through remote repositories and code branching.

  • Git Cheat Sheet

    Frequently used Git commands at a glance.

  • Git

    Git is more than a version control system. We'll show you how to get started with this powerful creation of Linus Torvalds and the kernel developers.

  • Getting with Git

    Git comes up all the time in discussions of Linux, but in our new world of repositories and package managers, many users are still unfamiliar with it. Read on to get started with this powerful version control environment.

  • Tree View

    Complex Git projects sometimes require a better view of the dependencies and branches. Several tools offer GUI options for Git. We take a look at gitk, gitg, git-gui, and GitAhead.

comments powered by Disqus