Questions tagged [branch]

A "branch" is a term used in version control systems to represent an independent line of development. Depending on the system, a repository can contain one or more branches. Branches are merged when changes need to propagate from one branch into another.

A "branch" is a term used in version control systems to represent an independent line of development. Depending on the system, a repository can contain one or more branches. Branches are merged when changes need to propagate from one branch into another.

Source: Wikipedia Branch (Version Control)

Related tags:

5403 questions
228
votes
2 answers

How do I move a Git branch out into its own repository?

I have a branch that I'd like to move into a separate Git repository, and ideally keep that branch's history in the process. So far I've been looking at git filter-branch, but I can't make out whether it can do what I want to do. How do I extract a…
Aupajo
  • 5,885
  • 6
  • 30
  • 28
215
votes
5 answers

Reordering of commits

I'm currently working on a branch and want some commits to merge into other branches: a-b-c-d-e-f-g (branchA) / --o-x-x-x-x-x-x-x-x-x-x (master) \ x-x-x-x-x (branchB) (Letters denote commits, and the x are irrelevant commits.) However…
Peter
  • 2,151
  • 2
  • 13
  • 3
213
votes
5 answers

Mercurial: Can I rename a branch?

We now have a "stiging" branch, where "staging" seems to be a far better semantic fit. What's a good strategy for handling this?
KevDog
  • 5,763
  • 9
  • 42
  • 73
212
votes
16 answers

Track all remote git branches as local branches

Tracking a single remote branch as a local branch is straightforward enough. $ git checkout --track -b ${branch_name} origin/${branch_name} Pushing all local branches up to the remote, creating new remote branches as needed is also easy. $ git…
Janson
  • 2,381
  • 3
  • 15
  • 7
206
votes
4 answers

What is a "stale" git branch?

A "Stale" git branch is a term I've heard a lot. I know it has something to do with branches which are regarded as less useful or useless, but cannot find an exact definition. What is a "stale" git branch?
cowlinator
  • 7,195
  • 6
  • 41
  • 61
204
votes
5 answers

Git commits are duplicated in the same branch after doing a rebase

I understand the scenario presented in Pro Git about The Perils of Rebasing. The author basically tells you how to avoid duplicated commits: Do not rebase commits that you have pushed to a public repository. I am going to tell you my particular…
elitalon
  • 9,191
  • 10
  • 50
  • 86
202
votes
11 answers

Listing and deleting Git commits that are under no branch (dangling?)

I've got a Git repository with plenty of commits that are under no particular branch, I can git show them, but when I try to list branches that contain them, it reports back nothing. I thought this is the dangling commits/tree issue (as a result of…
Samer Buna
  • 8,821
  • 9
  • 38
  • 55
194
votes
11 answers

How do I manage conflicts with git submodules?

I have a git superproject that references several submodules and I am trying to lock down a workflow for the rest of the my project members to work within. For this question, lets say my superproject is called supery and the submodule is called…
Tyler
  • 3,539
  • 3
  • 18
  • 14
193
votes
6 answers

Git branch strategy for small dev team

We have a web app that we update and release almost daily. We use git as our VCS, and our current branching strategy is very simple and broken: we have a master branch and we check changes that we 'feel good about' into it. This works, but only…
Bilal and Olga
  • 3,211
  • 6
  • 30
  • 33
190
votes
8 answers

View differences of branches with meld?

I know that I can view the difference between HEAD and current state with meld .. But how can I view the differences between branches, for example master and devel with meld? At the moment I do the following steps: Rename folder of working copy …
Marten Bauer
  • 3,099
  • 5
  • 22
  • 18
189
votes
4 answers

Putting uncommitted changes at Master to a new branch by Git

How can you put uncommitted changes to a branch TEST when I am at the branch master?
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
185
votes
17 answers

How to get default Git branch?

My team alternates between usage of dev and master as default branch for several repos and I would like to write a script that checks for the default branch when entering a directory. When pull requests are opened in some of these repos, they either…
random-forest-cat
  • 33,652
  • 11
  • 120
  • 99
184
votes
17 answers

Git push: "fatal 'origin' does not appear to be a git repository - fatal Could not read from remote repository."

I know similar questions have already been asked. But, I believe my issue is due to a mistake I have previously made and therefore is different: let me explain. Everything was working smoothly, as I could: git add . all the files from my local…
Thibaud Clement
  • 6,607
  • 10
  • 50
  • 103
183
votes
3 answers

git shallow clone (clone --depth) misses remote branches

After cloning a remote repository it does not show any remote branch by -a option. What could be the problem? How to debug it? In this snippet two of the remote branches are not shown: $ git clone --depth 1…
minghua
  • 5,981
  • 6
  • 45
  • 71
181
votes
11 answers

Delete local Git branches after deleting them on the remote repo

I want to have my local and remote repositories always in sync in terms of branches. After a Pull Request review on GitHub, I merge and remove my branch there (remote). How could I fetch this information in my local repository and get Git to remove…
sf89
  • 5,088
  • 7
  • 24
  • 27