Questions tagged [merge]

Merging is a generic term for combining two or more related sets of data. It is commonly associated with revision control systems when reconciling multiple changes made to a revision-controlled collection of files. Merging multiple data sets is another use of this tag.

Most often, it is necessary when a file is modified by two people on two different computers at the same time. When two branches are merged, the result is a single collection of files that contains both sets of changes.

In some cases, the merge can be performed automatically, because the changes do not conflict. In other cases, a person must decide exactly what the resulting files should contain. Many revision control software tools include merge capabilities.

Merge can be used as a verb ("to merge branches"), but can also be a noun ("this merge will be difficult").

Merging multiple data sets is another use of this tag.

Merge can also refer to the Ruby Hash#merge method for merge hashes or git merge command for git revision control system.

Merge is different from join in datasets which is primarily SQL based. Difference between merge and join for SAS is here http://www2.sas.com/proceedings/sugi30/249-30.pdf and for R is here How to join (merge) data frames (inner, outer, left, right)?

See Wikipedia: Merge Version Control.

21355 questions
539
votes
8 answers

What's the difference between 'git merge' and 'git rebase'?

What's the difference between git merge and git rebase?
Daniel Peñalba
  • 27,557
  • 31
  • 124
  • 209
519
votes
17 answers

How to import existing Git repository into another?

I have a Git repository in a folder called XXX, and I have second Git repository called YYY. I want to import the XXX repository into the YYY repository as a subdirectory named ZZZ and add all XXX's change history to YYY. Folder structure…
Vijay Patel
  • 15,030
  • 6
  • 29
  • 34
487
votes
22 answers

How to join multiple lines of file names into one with custom delimiter?

I would like to join the result of ls -1 into one line and delimit it with whatever i want. Are there any standard Linux commands I can use to achieve this?
JavaRocky
  • 17,871
  • 30
  • 87
  • 109
481
votes
17 answers

The following untracked working tree files would be overwritten by merge, but I don't care

On my branch I had some files in .gitignore On a different branch those files are not. I want to merge the different branch into mine, and I don't care if those files are no longer ignored or not. Unfortunately I get this: The following untracked…
CQM
  • 36,672
  • 69
  • 214
  • 357
444
votes
5 answers

When would you use the different git merge strategies?

From the man page on git-merge, there are a number of merge strategies you can use. resolve - This can only resolve two heads (i.e. the current branch and another branch you pulled from) using 3-way merge algorithm. It tries to carefully detect…
Otto
  • 16,619
  • 14
  • 54
  • 62
435
votes
4 answers

What is the difference between merge --squash and rebase?

I'm new to git and I'm trying to understand the difference between a squash and a rebase. As I understand it you perform a squash when doing a rebase.
GiH
  • 11,696
  • 13
  • 40
  • 53
433
votes
5 answers

Simple tool to 'accept theirs' or 'accept mine' on a whole file using git

I don't want a visual merge tool, and I also don't want to have to vi the conflicted file and manually choose the between HEAD (mine) and the imported change (theirs). Most of the time I either want all of their changes or all of mine. Commonly…
nosatalian
  • 5,991
  • 4
  • 18
  • 16
429
votes
11 answers

How do I merge changes to a single file, rather than merging commits?

I have two branches (A and B) and I want to merge a single file from branch A with a corresponding single file from Branch B.
Isuru
  • 6,867
  • 8
  • 26
  • 37
428
votes
13 answers

How do I concatenate or merge arrays in Swift?

If there are two arrays created in swift like this: var a:[CGFloat] = [1, 2, 3] var b:[CGFloat] = [4, 5, 6] How can they be merged to [1, 2, 3, 4, 5, 6]?
Hristo
  • 5,642
  • 3
  • 22
  • 35
405
votes
7 answers

How and/or why is merging in Git better than in SVN?

I've heard in a few places that one of the main reasons why distributed version control systems shine, is much better merging than in traditional tools like SVN. Is this actually due to inherent differences in how the two systems work, or do…
Mr. Boy
  • 52,885
  • 84
  • 282
  • 517
390
votes
3 answers

What to do with branch after merge

I had two branches: master and branch1. I just merged branch1 back into master and I'm done with that branch. Should I delete it or just let it sit around? Will deleting it cause any loss of data?
Alison
  • 4,810
  • 4
  • 15
  • 23
383
votes
4 answers

What Git branching models work for you?

Our company is currently using a simple trunk/release/hotfixes branching model and would like advice on what branching models work best for your company or development process. Workflows / branching models Below are the three main descriptions of…
HiQ CJ
  • 3,358
  • 3
  • 15
  • 11
378
votes
9 answers

What is the precise meaning of "ours" and "theirs" in git?

This might sound like too basic of a question, but I have searched for answers and I am more confused now than before. What does "ours" and "theirs" mean in git when merging my branch into my other branch? Both branches are "ours". In a merge…
CommaToast
  • 9,468
  • 7
  • 46
  • 65
357
votes
12 answers

Why am I getting tree conflicts in Subversion?

I had a feature branch of my trunk and was merging changes from my trunk into my branch periodically and everything was working fine. Today I went to merge the branch back down into the trunk and any of the files that were added to my trunk after…
Greg
  • 6,962
  • 11
  • 39
  • 52
324
votes
8 answers

How to merge lists into a list of tuples?

What is the Pythonic approach to achieve the following? # Original lists: list_a = [1, 2, 3, 4] list_b = [5, 6, 7, 8] # List of tuples from 'list_a' and 'list_b': list_c = [(1,5), (2,6), (3,7), (4,8)] Each member of list_c is a tuple, whose…
rubayeet
  • 8,598
  • 6
  • 41
  • 54