Reader small image

You're reading from  Git for Programmers

Product typeBook
Published inJun 2021
PublisherPackt
ISBN-139781801075732
Edition1st Edition
Right arrow
Author (1)
Jesse Liberty
Jesse Liberty
author image
Jesse Liberty

Jesse Liberty is a full-time hands-on programmer, specializing in C#, git and .NET MAUI. He hosts the popular Yet Another Podcast and is the author of more than a dozen best-selling programming books. Liberty is a Certified Xamarin Developer, a Xamarin MVP and a Microsoft MVP. He was a Technical Evangelist for Microsoft, Distinguished Software Engineer at AT&T; Software Architect for PBS and Vice President of Information Technology at Citibank, and he was on the teaching staff at Brandeis University. Jesse is a recognized expert and has spoken at conferences world-wide.
Read more about Jesse Liberty

Right arrow

Branches

Using branches is critical to working with Git, not to mention to the success of your project. The idea is this: you have a "main" branch that you'll do your releases from. Each time code is added to the main branch it is checked and reviewed so that the main branch stays as clean as possible.

When you want to work on a bug or a feature, you create a new branch (often called a feature branch). This creates a copy of the code that is currently in the main branch. You can work on your feature branch without affecting the main branch at all. Once you are done, and all is working, you can then "merge" your feature branch into the main branch:

Figure 3.11: First feature branch

Notice that there is a pointer named Head. This points to whatever is in your work area. In this case, we've branched to Feature 1 and Head shows that the code for that feature branch is now in our work area.

That is a pretty good simplification of branching...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Git for Programmers
Published in: Jun 2021Publisher: PacktISBN-13: 9781801075732

Author (1)

author image
Jesse Liberty

Jesse Liberty is a full-time hands-on programmer, specializing in C#, git and .NET MAUI. He hosts the popular Yet Another Podcast and is the author of more than a dozen best-selling programming books. Liberty is a Certified Xamarin Developer, a Xamarin MVP and a Microsoft MVP. He was a Technical Evangelist for Microsoft, Distinguished Software Engineer at AT&T; Software Architect for PBS and Vice President of Information Technology at Citibank, and he was on the teaching staff at Brandeis University. Jesse is a recognized expert and has spoken at conferences world-wide.
Read more about Jesse Liberty