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
98
votes
2 answers

Consequences of using graft in Mercurial

There've been several questions recently about skipping changes when maintaining release branches in Mercurial. For example: Mercurial: Branch specific changes keep coming back after dummy merge Why are Mercurial backouts in one branch affecting…
Paul S
  • 7,645
  • 2
  • 24
  • 36
96
votes
5 answers

How do I change which GitHub project I forked from?

I forked a project, made some changes, and got a pull request accepted. But now, the project I forked moved to another repository and is a fork of that repository. That is: Original -> MyFork Now: NewOriginal -> Original -> MyFork How would I get…
LanguagesNamedAfterCofee
  • 5,782
  • 7
  • 45
  • 72
93
votes
6 answers

Is it possible to view multiple git branches at the same time for the same project?

I have 2 branches, which are not ready to be merged yet, but have some complementary logic, which I'd like to review (before merging) Can I check out multiple git branches of the same project? Is it possible?
James Raitsev
  • 92,517
  • 154
  • 335
  • 470
92
votes
3 answers

Showing commits made directly to a branch, ignoring merges in Git

When using git, is there a way to show commits made to a branch, while ignoring all commits that were brought in by merging? I'm trying to review the code changes made on a branch while ignoring the ones we made on other branches that were merged…
Channel Cat
  • 923
  • 1
  • 6
  • 4
89
votes
4 answers

How to change branch name in Azure DevOps

Is there a way to change branch name in Azure DevOps. As shown in SS i have named my branch as Developer branch, now i want to change it to a specific request-id. Is this possible.
Salman
  • 1,573
  • 3
  • 13
  • 24
88
votes
8 answers

git merge: Removing files I want to keep!

How can you merge two branches in git, retaining necessary files from a branch? When merging two branches, if a file was deleted in one branch and not in another, the file is ultimately deleted. For example: A file exists in master when you make a…
drfloob
  • 3,154
  • 1
  • 24
  • 31
86
votes
13 answers

Get git branch name in Jenkins Pipeline/Jenkinsfile

I've create a jenkins pipeline and it is pulling the pipeline script from scm. I set the branch specifier to 'all', so it builds on any change to any branch. How do I access the branch name causing this build from the Jenkinsfile? Everything I…
Alex Yurkowski
  • 1,676
  • 1
  • 12
  • 26
86
votes
7 answers

Git pull into wrong branch

Myself and one other developer had been merging and pushing our work to a non-master branch called toolwork. That way, we didn't impact the rest of the team. My topic branch was called DPM-93 and my git workflow was this. # do some work git checkout…
milkplus
  • 33,007
  • 7
  • 30
  • 31
85
votes
3 answers

Git - how to force merge conflict and manual merge on selected file

We maintain web application which has common master branch and many parallel branches, one for each installation, each have few specific changes. Source code is managed in git and it is terrific tool when we need transfer features and bugfixes from…
Stepan
  • 1,430
  • 2
  • 14
  • 11
84
votes
4 answers

Meaning of Github Ahead/Behind Metrics

In plain language (hopefully with a simple example), what do the ahead/behind metrics on a Github repo's branch mean? And what are the implications for that branch and the attention it's receiving? Is being "behind" a bad sign for a branch?
LikeMaBell
  • 1,529
  • 2
  • 13
  • 24
84
votes
3 answers

How to rebase a branch off a rebased branch?

So my history looks like this: o---o---o---o master \ o---o---o A \ o B So, to explain: I have branch A which was started from master I have branch B (with only 1 commit) which was started from A What…
Radu Murzea
  • 10,724
  • 10
  • 47
  • 69
84
votes
4 answers

Git branch deletion

In Git, what does "deletion" of a branch mean? Will it be gone from the repository? Or will it still be navigable to via git branch? What I really want to do is mark a branch as "dead end", i.e., the branch is so far from master, that nobody should…
bobobobo
  • 64,917
  • 62
  • 258
  • 363
83
votes
9 answers

Where did I branch from?

I got back on an old project and I ran the nice git status to figure out what was going on and I noticed way too many branches! I want to do some housekeeping before starting to work on this again but I'm not sure which branch comes from…
Marsellus Wallace
  • 17,991
  • 25
  • 90
  • 154
82
votes
2 answers

Push a commit in two branches with Git

how do I push a commit in two branches? I can't use "git push", because then it pushes to three branches, and i just want the commit in two of them.. Ive tried a "git merge HEAD --commit id from branch A--" in branch B, but then it takes…
Madoc
  • 1,605
  • 3
  • 17
  • 30
82
votes
5 answers

Replace remote tag with Git

I have some tags on my "origin" repository. Then I realized I needed to add some changes on one of the tags, and push them back on my repository. Is there a way I can push an existing tag to the repository in one time, or should I delete the tag…
azmeuk
  • 4,026
  • 3
  • 37
  • 64