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
5650
votes
49 answers

How do I merge two dictionaries in a single expression (taking union of dictionaries)?

I have two Python dictionaries, and I want to write a single expression that returns these two dictionaries, merged (i.e. taking the union). The update() method would be what I need, if it returned its result instead of modifying a dictionary…
Carl Meyer
  • 105,276
  • 18
  • 102
  • 113
1841
votes
5 answers

How to replace master branch in Git, entirely, from another branch?

I have two branches in my Git repository: master seotweaks (created originally from master) I created seotweaks with the intention of quickly merging it back into master. However, that was three months ago and the code in this branch is 13…
Jason
  • 20,027
  • 4
  • 24
  • 50
1786
votes
25 answers

How do you merge two Git repositories?

Consider the following scenario: I have developed a small experimental project A in its own Git repo. It has now matured, and I'd like A to be part of larger project B, which has its own big repository. I'd now like to add A as a subdirectory of…
static_rtti
  • 46,349
  • 44
  • 123
  • 180
1595
votes
80 answers

How to merge two arrays in JavaScript and de-duplicate items

I have two JavaScript arrays: var array1 = ["Vijendra","Singh"]; var array2 = ["Singh", "Shakya"]; I want the output to be: var array3 = ["Vijendra","Singh","Shakya"]; The output array should have repeated words removed. How do I merge two arrays…
Vijjendra
  • 20,365
  • 9
  • 54
  • 86
1358
votes
13 answers

How to join (merge) data frames (inner, outer, left, right)

Given two data frames: df1 = data.frame(CustomerId = c(1:6), Product = c(rep("Toaster", 3), rep("Radio", 3))) df2 = data.frame(CustomerId = c(2, 4, 6), State = c(rep("Alabama", 2), rep("Ohio", 1))) df1 # CustomerId Product # 1 Toaster # …
Dan Goldstein
  • 21,713
  • 17
  • 34
  • 41
1237
votes
23 answers

Merge / convert multiple PDF files into one PDF

How could I merge / convert multiple PDF files into one large PDF file? I tried the following, but the content of the target file was not as expected: convert file1.pdf file2.pdf merged.pdf I need a very simple/basic command line (CLI) solution.…
alcohol
  • 19,052
  • 4
  • 21
  • 21
1140
votes
9 answers

How to merge a specific commit in Git

I have forked a branch from a repository in GitHub and committed something specific to me. Now I found the original repository had a good feature which was at HEAD. I want to merge it only without previous commits. What should I do? I know how to…
netawater
  • 13,382
  • 4
  • 21
  • 20
1107
votes
7 answers

What is the difference between `git merge` and `git merge --no-ff`?

Using gitk log, I could not spot a difference between the two. How can I observe the difference (with a git command or some tool)?
user1162226
  • 11,163
  • 3
  • 12
  • 8
992
votes
15 answers

JPA EntityManager: Why use persist() over merge()?

EntityManager.merge() can insert new objects and update existing ones. Why would one want to use persist() (which can only create new objects)?
Aaron Digulla
  • 297,790
  • 101
  • 558
  • 777
714
votes
12 answers

Git pull a certain branch from GitHub

I have a project with multiple branches. I've been pushing them to GitHub, and now that someone else is working on the project I need to pull their branches from GitHub. It works fine in master. But say that someone created a branch xyz. How can I…
tybro0103
  • 43,805
  • 32
  • 138
  • 167
664
votes
16 answers

Embedding DLLs in a compiled executable

Is it possible to embed a pre-existing DLL into a compiled C# executable (so that you only have one file to distribute)? If it is possible, how would one go about doing it? Normally, I'm cool with just leaving the DLLs outside and having the setup…
Merus
  • 8,236
  • 5
  • 26
  • 41
637
votes
18 answers

What's the best visual merge tool for Git?

What's the best tool for viewing and editing a merge in Git? I'd like to get a 3-way merge view, with "mine", "theirs" and "ancestor" in separate panels, and a fourth "output" panel. Also, instructions for invoking said tool would be great. (I still…
andy
  • 16,174
  • 9
  • 28
  • 27
615
votes
5 answers

git cherry-pick says "...38c74d is a merge but no -m option was given"

I made some changes in my master branch and want to bring those upstream. When I cherry-pick the following commits. However, I get stuck on fd9f578 where git says: $ git cherry-pick fd9f578 fatal: Commit fd9f57850f6b94b7906e5bbe51a0d75bf638c74d is a…
wufoo
  • 10,915
  • 12
  • 49
  • 78
563
votes
5 answers

Pandas Merging 101

How to perform a (INNER| (LEFT|RIGHT|FULL) OUTER) JOIN with pandas? How do I add NaNs for missing rows after merge? How do I get rid of NaNs after merging? Can I merge on the index? How do I merge multiple DataFrames? Cross join with pandas? merge?…
cs95
  • 274,032
  • 76
  • 480
  • 537
549
votes
27 answers

Merging dictionaries in C#

What's the best way to merge 2 or more dictionaries (Dictionary) in C#? (3.0 features like LINQ are fine). I'm thinking of a method signature along the lines of: public static Dictionary
orip
  • 66,082
  • 20
  • 111
  • 144
1
2 3
99 100