🌐
Git
git-scm.com › docs › git-branch
Git - git-branch Documentation
When a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch.<name>.remote and branch.<name>.merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch. This behavior may be changed via the global ...
Reference
git · config · help · bugreport · Credential helpers · init · clone · add · status · diff · commit · notes · restore · reset · rm · mv · branch · checkout · switch · merge · mergetool · log · stash · tag · worktree · fetch · pull · push · remote ·
About
The entire Pro Git book written by Scott Chacon and Ben Straub is available to read online for free. Dead tree versions are available on Amazon.com · Git was built to work on the Linux kernel, meaning that it was built to handle repositories with tens of millions of lines of code from the start.
Install
The entire Pro Git book written by Scott Chacon and Ben Straub is available to read online for free. Dead tree versions are available on Amazon.com · Choose your operating system above
GUIs
The entire Pro Git book written by Scott Chacon and Ben Straub is available to read online for free. Dead tree versions are available on Amazon.com · Git comes with built-in GUI tools for committing (git-gui) and browsing (gitk), but there are several third-party tools for users looking for ...
🌐
Git
git-scm.com › book › en › v2 › Git-Branching-Branches-in-a-Nutshell
Git - Branches in a Nutshell
A branch in Git is simply a lightweight movable pointer to one of these commits. The default branch name in Git is master. As you start making commits, you’re given a master branch that points to the last commit you made.
Discussions

Branching for dummies?
I would recommend playing with https://learngitbranching.js.org/ More on reddit.com
🌐 r/git
14
4
December 2, 2021
ELI5: Git Branches

Let's say you have written a social networking website. You write a bunch of code, then your site goes live on January 1. We will call this version 1.0. After the site is up and running you want to write some new features, and plan to release them on April 1.

Uh oh. Mid February you get a report of a serious bug in your program. You need to fix that bug now. You could add the bug fix to all the code you've written since January, but that has some problems. All that code you've written since January is not ready to release. It needs more work and won't be ready until April. If you code your bug fix on top of all the new code, you either have to release the unfinished code, or wait until April. Neither of those options work.

Instead, what you do is you go back in your repository to version 1.0. You code your fixes on top of that "older" version, and call this version 1.1. You then release version 1.1 and things are good.

However, there's one small problem. The history of your project now looks like this.

      v1.0               new code for Apr
      |                    |
o--o--o--o--o--o--o--o--o--o
       \
        o
        |
        v1.1 (bug fix)

The history of your project is no longer linear. It has two branches. If another serious bug comes up again, you can code it on top of version 1.1 and release that.

      v1.0               new code for Apr
      |                    |
o--o--o--o--o--o--o--o--o--o
       \
        o--o
        |  |
        |  v1.2
        v1.1

Eventually, when all the new code will be ready for the April release. But there's one last problem to solve. The bug fixes you put into production (v1.1, v1.2) are not part of the new code for April release. To solve this, you merge the two branches into a single branch.

      v1.0                    v2.0
      |                       |
o--o--o--o--o--o--o--o--o--o--o
       \                     /
        o--o----------------'
        |  |
        |  v1.2
        v1.1

Now you have a version 2.0 that contains all the new features for April, and the bug fixes that you had to release in February.

More on reddit.com
🌐 r/explainlikeimfive
2
1
September 19, 2012
ELI5: What really is Git branches, how to effectively use them, and whether or not we followed good git workflow.
In general, a branch is a separate version of your code while commits represent changes (as u/insertAlias pointed out, commits are not stored as whole separate versions of your code, just the differences from the previous commit). There are many philosophies on how to use git, so your branching model is going to determine the semantics of your branches. I think it's best to show by example: Let's say you're developing a game. Let's go with git-flow for git workflow. You would have a master branch, which would contain releases of your game which you publish on GOG or whatever. Then, you would create a new branch from master, develop. Here you would have the current development version of the game, which would contain stuff that isn't necessarily ready for release. Then, when you're happy with the changes you made on develop, it's time to get those changes to master. This is where pull requests and merging come in. In this situation, you would accomplish a merge simply by switching to master and pulling develop into master. This takes the changes you made on develop and tries to apply them to master. A better practice for when you're working with multiple people would be to create a pull request from develop into master. This basically says "hey, I have some changes in develop I want to put to master, whoever is in charge of master should take a look at them and merge them in if they like then". For the pull request, you would add some reviewers (like your boss or coworkers at work), and when they approve it, you can merge. You had a problem with merge conflicts. This is completely normal and it's not so intuitive for people starting with git. When multiple people work on the same codebase, it's inevitable that two people will change the same thing in different ways. If that happens and you try to merge, git basically says "hey, I can't figure out which of these changes should be the new state of the branch, I need you, the human, to help me figure it out". Let's say you pulled develop into master and there are conflicts. Then, your working copy of master will enter a "merging" state, where in places with conflicts, you will see both versions of the piece of code that is conflicted. You can then make edits to make it right (either pick one of the two versions, or you can keep both, or even mix and match). After you fix all these conflicts, you will do a commit and your changes will be successfully merged. From what I understood from your post, all three of you were working on the same branch, pushing directly to develop. This is not a good way of doing things, because what could happen is you start working on something, meanwhile someone else does something and pushes it to develop, and then when you try to push, it says NOPE, because your working copy is based on a commit that is not the latest on develop. That means you would have to painfully manually integrate your changes almost every commit, and imagine that on a team with 10+ devs. This is where feature branches of git-flow are useful. Let's say you guys want your game to have a feature of posting your score to Facebook. You talk about it and you decide that you personally will implement that. You then do a branch from develop and name it feature/add-facebook-integration or something like that. You will then do all the work needed to finish that feature, all on this branch. None of your colleagues will commit to this branch, so you don't have to worry about any conflicts until it's time to merge. So you can peacefully develop and test your new feature against some version of develop, until the feature is ready to go to develop. Then you either create a pull request or merge it directly, while resolving any merge conflicts in the merge commit (which is likely to happen if your feature takes some time to make and your colleagues did something in the meantime). So with three of you, you can see that all 3 can be working on 3 separate features, and you will not have any conflict problems, only once a feature is finished and needs to be merged with the other people's stuff. Fetching means just getting information about possible changes in the repository from the remote (for example from your Github.com repository). Pulling means taking the changes and actually putting them on your branch. Your colleagues could indeed work on your repo because you gave them the rights to do that, in practice, teams usually use some branching model where only a select few project leads are allowed to commit to develop and master, and all commits to these branches must be merge commits, which means that all development is happening on feature or similar branches, which are branched from develop, the dev does some work on it, and then makes a pull request for the repository administrators to review and potentially pull into develop. Here is an image I found within 10 seconds of googling showing a simple git history with master, develop and two feature branches. Note: I'm certainly not a "git ninja" and I massively oversimplified some things and completely omitted others, but there are a ton of great resources out there for learning git, so I encourage you to go out there and learn. If anyone finds any inaccuracies in my comment, please tell me, I'll be glad to learn something new as well. More on reddit.com
🌐 r/learnprogramming
4
3
October 22, 2018
Advice for Git branching strategy?
First, it sounds like you're already fucked. You might not be, but it definitely sounds like you didn't know that you should be using feature flags, or you don't have enough pull at your company to convince people that they should be. All of you problems get easier when you can do this, don't try to look for a way to solve this in git... it only gets more painful. Trust me I've been there. Here is my thoughts. feature flags every.epic.gets.a.featureflag at least one. you can have more. make sure the naming is predictable make sure your PO is documenting these on the epics if not the stories. no exceptions. no. stop crying, just do it. master auto deploy to dev environment only promise here is that it builds and doesn't break other devs workflow QA aren't allowed to complain that it's broken, only allowed to let you know it's broken. feat/abc-123-my-new-feature branches MUST have a ticket in the name branches MUST start with feat, fix, chore, feature can be feature/... fix/.... chore/.... whatever. it's the tickets that go towards completing a story which in turn indicate completion of an epic. these branches are allowed to PR into master or release/... create branch protection rules in github: block PR until you get ticks. turn on CODEOWNERS, learn it. implement it. use some kind of PR preview service if your code can make use of it. vercel does this automatically, but you can spin up one on demand via github actions too. squash merge, disable all other methods you won't need them. block PR if out of date with master turn on Merge Queue. require it. have unit tests, run them. block PR if they fail. have a linter. run them. block PR if it fails. if you are using a typed language. block PR if that fails. the theme here is that PR merged === a promise that it won't break the other devs builds (outside of any dumb shit they're doing on their branches). release/... make these from master ONLY once made, NEVER ADD MASTER AGAIN. these are snapshots that either get force pushed somewhere else to trigger a build or from which artifacts are created and pushed (github actions can easily do this) these branches are put onto your QA queue: send to staging QA ok it send it to prod problems? make a PR from the release branch back into the release branch. ( a hotfix ). but now you also have to merge these fixes back to develop by way of an intermediary branch. You can automate this, there are github actions out there that handle this. deployments if you have only one app in the repo, then its easy. master: when package.json#version changes, push to dev environment when no package.json#version changes it means a PR is merged and you should do some kind of calculate the next version step release/vx.x.x: when no package.json#version changes: change bump a buildnumber on vx.x.x-buildnumber of the version and commit back. write a github workflow that only runs when you manually run it. this workflow should allow you to choose the target environment from a dropdown if you have more than one app: and you have yet to migrate to a correctly done monorepo: start learning NXDEV. no do not move to turbo. ignore bazel, pants etc they're way too complicated for you. focus on nxdev. create an auxillary workfow that rewrites your release deployment workflow based on a template so that you now have two dropdowns: apps, target environments Why feature flags? allow you do push code out the door that business isn't ready to activate allows you to avoid those fucking orrible long lived branches that nobody loves rebasing. seriously fucks those branches. allows you to a/b test things now There's so many tools out there that do feature flags, but some things you need to keep in mind: don't be a noob and use a configuration file instead of a service. just don't. You'll end up hating yourself and the mangers will resent the push to feature flags because now you cant turn a feature off/on without a deployment. dont use environment variables, they won't allow you to react to users differently. it's not a developer only consideration, your PO and your BA all need to know and understand what it means. Do us all a favour and drag them out of the last century so when we change jobs there's less dumbshit managers around. dont home roll your own service, pick one that has big infrastructure behind it. it'll get called A LOT. just use launchdarkly or a service better than it. standardise the ways in which you'll identify your user to the feature flag service across your apps. MAKE.THEM.BE.EXACTLY.THE.SAME. you'll see what i mean when you inevitably ignore this piece of advice. Ok now for the detractors QQ y u no git tag creating a release branch with the version in the branch name means it's a lot easier to write CI rules for and to add further hotfixes to for inexperienced devs QQ y u call it master go away QQ feature flags are too much work cool story. enjoy your life of rebase hell. More on reddit.com
🌐 r/git
4
17
March 8, 2023
🌐
Git
git-scm.com › book › en › v2 › Git-Branching-Branch-Management
Git - Branch Management
Now that you’ve created, merged, and deleted some branches, let’s look at some branch-management tools that will come in handy when you begin using branches all the time. The git branch command does more than just create and delete branches.
🌐
W3Schools
w3schools.com › git › git_branch.asp
Git Branch
In Git, a branch is like a separate workspace where you can make changes and try new ideas without affecting the main project.
🌐
Git
git-scm.com › book › en › v2 › Git-Branching-Basic-Branching-and-Merging
Git - Basic Branching and Merging
The iss53 branch has moved forward with your work · Now you get the call that there is an issue with the website, and you need to fix it immediately. With Git, you don’t have to deploy your fix along with the iss53 changes you’ve made, and you don’t have to put a lot of effort into reverting those changes before you can work on applying your fix to what is in production.
🌐
Atlassian
atlassian.com › git › tutorials › using branches
How to Create a Branch in Git? | Atlassian Git Tutorial
December 15, 2025 - New commits are recorded in the history for the current branch, which results in a fork in the history of the project. The git branch command lets you create, list, rename, and delete branches.
🌐
Medium
medium.com › @jacoblogan98 › understanding-git-branching-5d01f3dda541
Understanding Git Branching
April 19, 2022 - This may also lead to merge conflicts if branches are not kept up to date with the main. Ultimately, this method is not optimal for most situations, due to how slow the process can be, and how complicated it is. With the Git flow branching strategy, things get even more complicated.
Find elsewhere
🌐
Codecademy
codecademy.com › learn › fscp-git-and-github-part-ii › modules › fscp-git-branching › cheatsheet
Git and GitHub, Part II: Git Branching Cheatsheet | Codecademy
In Git, the main project is completed on the main branch. Making your first commit in a new git repository will automatically create a main branch. Create new branches from the main branch to develop new features for a project.
🌐
Git Tower
git-tower.com › learn › git faq › how to create a branch in git (local & remote)
How to Create a Branch in Git (Local & Remote) | Learn Version Control with Git
5 days ago - Create a local branch with git branch or a remote branch with git push -u origin . Complete guide to creating Git branches.
🌐
GeeksforGeeks
geeksforgeeks.org › git › introduction-to-git-branch
Introduction to Git Branch - GeeksforGeeks
January 15, 2026 - Once the work is complete, the changes can be merged back into the main or master branch. ... Git branches allow you to manage different tasks or features in isolation without affecting the main project.
🌐
GitKraken
gitkraken.com › home › learn › branching in git
Git Branch - How to Branch | Learn Git
March 26, 2026 - This model safeguards against merging unstable code and provides the opportunity to tidy up the commit history before integrating changes into the main branch. If you want to create a Git branch using the terminal, you can use the git branch command, followed by your desired branch name.
🌐
Nobledesktop
blog.nobledesktop.com › learn › git › git branches: list, create, switch to, merge, push, & delete
Git Branches: List, Create, Switch, Merge, Push, Delete
April 19, 2026 - Walk through essential Git branch commands—listing, creating, switching, merging, pushing, and deleting—with practical examples for managing parallel work.
🌐
ITU Online
ituonline.com › tech-definitions › what-is-git-branch
What is Git Branch? – ITU Online IT Training
June 3, 2024 - Branches are the standard way teams isolate features, fixes, and experiments, then merge them back into main when the work is ready. ... Git branch is a movable reference to a commit in a repository that creates a separate line of development without copying the entire codebase.
🌐
Linux Kernel
kernel.org › pub › software › scm › git › docs › git-branch.html
git-branch(1)
When a local branch is started off a remote-tracking branch, Git sets up the branch (specifically the branch.<name>.remote and branch.<name>.merge configuration entries) so that git pull will appropriately merge from the remote-tracking branch. This behavior may be changed via the global ...
🌐
GitKraken
gitkraken.com › home › learn › tutorials › learn git: how to git branch
How to Git Branch | Beginner Git Tutorial
May 26, 2021 - In Git, a branch is a pointer to a specific commit. The branch pointer moves along with each new commit you make, and only diverges in the graph if a commit is made on a common ancestor commit.
🌐
Varonis
varonis.com › blog › git-branching-and-merging
Git Branching and Merging: A Step-By-Step Guide
September 12, 2025 - Git branching lets developers work independently from the main production code, whether to fix bugs, add features, or experiment safely. When you create a branch, you're essentially working with a copy of the code, leaving the original untouched.
🌐
Reddit
reddit.com › r/git › branching for dummies?
r/git on Reddit: Branching for dummies?
December 2, 2021 -

I need someone to explain this to me because I feel like an idiot and I'm getting frustrated. This is at least the third time I've tried to get even a rudimentary understanding of git and it just doesn't take.

I'm walking through this guide because based on the title it should be my speed: https://medium.com/@rukeeojigbo/git-basics-an-idiots-guide-99445a56bd65

Switching between branches sounds simple enough. So I create FirstBranch and edit a text file in it. Cool, git status lets me know there are new changes it detected. Well I don't want to commit anything yet, I want to continue playing around with branches. So I create SecondBranch and check the text file. The text file has the same content that it did on FirstBranch. I guess that makes sense since we were sitting in FirstBranch when we created SecondBranch. I edit the text file with some blurb about it being in SecondBranch. Branches are basically just folders I can swap between right, so let's hop back over to FirstBranch and see that other version of the text file that doesn't have any references to SecondBranch. Oh it does have references to SecondBranch, which means this doesn't work at all the way I thought it did. Now I'm just confused and frustrated.

I need an idiot's guide to git and I'm beginning to think one doesn't exist because it's simply too complex of a tool for me and I'm going to just go back to manually making dated copies of the project folder every time I need to snapshot progress.

🌐
DataCamp
datacamp.com › tutorial › git-branch
Git Branch: Creating, Managing, and Merging Branches | DataCamp
May 6, 2025 - Now that we've set the stage, let's break down what a Git branch is. At its core, a Git branch isn't a separate folder or a full copy of your codebase; it's just a lightweight pointer for a particular commit.
🌐
nvie.com
nvie.com › posts › a-successful-git-branching-model
A successful Git branching model » nvie.com
January 5, 2010 - This model was conceived in 2010, now more than 10 years ago, and not very long after Git itself came into being. In those 10 years, git-flow (the branching model laid out in this article) has become hugely popular in many a software team to the point where people have started treating it like a standard of sorts — but unfortunately also as a dogma or panacea.
🌐
Novatorsoft
novatorsoft.com › en › blog › what-is-branch-how-to-use
What is a Branch and How to Use It? — Github #7 | Novatorsoft
November 25, 2023 - One of the most important features of Git is that the project can be developed in different branches. Branches allow tracking and management of different versions of the project.