Questions tagged [branching-and-merging]

In version control, branches represent parallel lines of development. Merging is the action that integrates changes made in different branches.

Modern version control systems (VCS) handle branching and merging by keeping track of incremental differences in data. When a user creates a branch of a project and begins making edits to that branch, only the edits made are tracked (as opposed to the user editing a true copy of the project). When the user have finished making changes to the branch, these edits are applied in order onto the destination of the merge, branches to be made and merged at any time.

Conflicts may arise if multiple changes are made to the same data in a project. Modern VCSs will alert the user and ask them to resolve the merge conflicts (choose which changes should be kept) before completing the merge.

1503 questions
45
votes
4 answers

Why does git merge a branch into itself?

I awoke this morning and looked at the commit history of one of my dev team's private repositories on BitBucket. I saw this: Anonymous committed fcde879 MERGE Merge branch 'develop' of https://bitbucket.org/abc/xyz into develop This is, uh,…
Jonathan Voss
  • 1,126
  • 1
  • 9
  • 24
45
votes
1 answer

Can we commit on branch that's already been merged with master?

I have a branch, say "XYZ", I worked and did a few commits on that branch and later merged it with my master branch. Now, I want to do some more changes in my code and want to use that same branch. I have not deleted the branch. Can I use the same…
ihaider
  • 1,290
  • 4
  • 19
  • 38
44
votes
4 answers

Are merges in Git symmetric?

Lets say we have two branches (B and C) that have diverged from a common ancestor A. Will merging from B to C produce the same result as merging from C to B? A | / \ B C To clarify- I'm assuming that any manual merge conflict resolutions…
Eyal
  • 3,412
  • 1
  • 44
  • 60
43
votes
2 answers

How to undo git flow feature finish?

I am learning git-flow and I just did git flow feature finish , which merged my feature branch to develop and removed it. Instead of this, I want to push the feature branch to github, so I can merge it after a peer review. So the…
hakunin
  • 4,041
  • 6
  • 40
  • 57
42
votes
1 answer

Merging one change to multiple branches in Git

I am used to having one main branch (master) and working in topic branches. But I'm working on a project now with two main branches (master and experimental) and I am unsure how to best merge my topic branch into both? Is this the right way to do…
user1015384
  • 579
  • 1
  • 5
  • 7
40
votes
1 answer

Git octopus merge order of multiple branches

I had an interesting thing happen using git, wondering if anyone could explain it to me so I can understand better. When doing a merge of multiple branches (A,B), git merge A B fails as non-fast-forward, while git merge B A worked well. Why…
James Maroney
  • 3,136
  • 3
  • 24
  • 27
39
votes
2 answers

Git merge diff3 style need explanation

I've merged 2 branches and conflicts appeared, I would need some hints where it starts where it ends, etc. I've replaced the code with some faked data to make it easier to read and talk about. <<<<<<< HEAD aaaaaa ||||||| merged common…
mingle
  • 1,567
  • 1
  • 16
  • 19
39
votes
3 answers

Is it possible to use the git-flow model with Subversion?

We use Subversion and aside from a few individuals such as myself there is little to no experience with branching and merging in Subversion. My Subversion experience is limited to simple feature branches where merge and tree-conflicts, while not…
Ryan Taylor
  • 8,740
  • 15
  • 65
  • 98
37
votes
3 answers

Unshelve to another branch

I'm trying to unpack my changes to the another branch using TFS Power Tools. I'm trying to execute command tfpt unshelve /migrate "NuGet Build" "/source:$/ProjectName/Main/Source" "/target:$/ProjectName/Main/Source-NuGet" But it returns message…
34
votes
4 answers

How can I overwrite, not merge, one remote branch into another branch?

I have two branches. Staging and Beta. Staging has code in it ( including files ), that I do not want at all. How can I make Beta completely overwrite Staging, so that none of those files or code are merged from Staging into Beta. I see some people…
Trip
  • 26,756
  • 46
  • 158
  • 277
33
votes
3 answers

How does one work on a new git branch that depends on another git branch that is not yet merged?

Here's my scenario: My project is following the topic branching pattern. I create a branch to fix some problems, let's call this branch problem_fixes. I make my changes, and submit a pull request. I need to start work on a new feature, so I create…
mtjhax
  • 1,988
  • 1
  • 18
  • 23
32
votes
2 answers

How do I get the SCM URL inside a Jenkins Pipeline or Multibranch Pipeline?

I am trying to get a prebuild merge to work inside a multibranch pipeline and I would like to avoid having to hardcode the git url in my pipeline script. It seems like scm step must store the url somehow, but I cannot figure out how to access it.
32
votes
2 answers

What are .rej files which are created during merge

I was merging master branch into new branch, there are some .rej files are created. I took a pool of master branch into new branch I got conflicts which I've resolved but there are some .rej files. Can you please help me to know about the .rej…
GajanaN Chalke
  • 517
  • 1
  • 5
  • 13
32
votes
2 answers

How do I use git flow with a staging environment?

We are using git-flow to handle hotfixes & features, with a develop branch & the master branch (for production). What is the easiest way to add a staging branch to the mix so that we can validate work that is on its way to production from develop…
Eric
  • 5,815
  • 3
  • 25
  • 34
32
votes
1 answer

Git - move branch to master

I have a branch with actual sources and I did not make any commits for a long time to master, and at the moment it's completely out of date. I want to just replace master's content with the content of my branch. One way to do it is to checkout both…
Rostyslav Druzhchenko
  • 3,673
  • 3
  • 33
  • 38