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
321
votes
15 answers

Git merge reports "Already up-to-date" though there is a difference

I have a git repository with 2 branches: master and test. There are differences between master and test branches. Both branches have all changes committed. If I do: git checkout master git diff test A screen full of changes appears showing the…
Charles Darke
  • 3,521
  • 3
  • 16
  • 9
315
votes
3 answers

Git Cherry-pick vs Merge Workflow

Assuming I am the maintainer of a repo, and I want to pull in changes from a contributor, there are a few possible workflows: I cherry-pick each commit from the remote (in order). In this case git records the commit as unrelated to the remote…
cmcginty
  • 101,562
  • 37
  • 148
  • 155
308
votes
11 answers

Oracle: how to UPSERT (update or insert into a table?)

The UPSERT operation either updates or inserts a row in a table, depending if the table already has a row that matches the data: if table t has a row exists that has key X: update t set mystuff... where mykey=X else insert into t…
Mark Harrison
  • 267,774
  • 112
  • 308
  • 434
287
votes
9 answers

Simultaneously merge multiple data.frames in a list

I have a list of many data.frames that I want to merge. The issue here is that each data.frame differs in terms of the number of rows and columns, but they all share the key variables (which I've called "var1" and "var2" in the code below). If the…
bshor
  • 4,101
  • 8
  • 21
  • 30
284
votes
13 answers

What's the best three-way merge tool?

Subversion, Git, Mercurial and others support three-way merges (combining mine, theirs, and the "base" revision) and support graphical tools to resolve conflicts. What tool do you use? Windows, Mac OS X, Linux, free or commercial, you name…
Dan Fabulich
  • 31,628
  • 35
  • 121
  • 153
277
votes
4 answers

Can I make fast forwarding be off by default in git?

I can't really ever think of a time when I would use git merge rather than git rebase and not want to have a commit show up. Is there any way to configure git to have fast forwarding off by default? The fact that there's an --ff option would seem…
Jason Baker
  • 171,942
  • 122
  • 354
  • 501
260
votes
14 answers

Apply pandas function to column to create multiple new columns?

How to do this in pandas: I have a function extract_text_features on a single text column, returning multiple output columns. Specifically, the function returns 6 values. The function works, however there doesn't seem to be any proper return type…
smci
  • 26,085
  • 16
  • 96
  • 138
240
votes
4 answers

How to correctly close a feature branch in Mercurial?

I've finished working on a feature branch feature-x. I want to merge results back to the default branch and close feature-x in order to get rid of it in the output of hg branches. I came up with the following scenario, but it has some issues: $ hg…
Andrey Vlasovskikh
  • 15,474
  • 6
  • 38
  • 59
230
votes
12 answers

pandas three-way joining multiple dataframes on columns

I have 3 CSV files. Each has the first column as the (string) names of people, while all the other columns in each dataframe are attributes of that person. How can I "join" together all three CSV documents to create a single CSV with each row…
lollercoaster
  • 13,421
  • 28
  • 94
  • 162
221
votes
4 answers

merge one local branch into another local branch

I have multiple branches which are branched off the master (each in a separate subdirectory). Branch1: new development, not yet completely finished Branch2: hotfix for a problem, but still under test Branch3: mess around branch, which I will not…
Nemelis
  • 2,926
  • 2
  • 14
  • 28
219
votes
6 answers

Merge two dataframes by index

I have the following dataframes: > df1 id begin conditional confidence discoveryTechnique 0 278 56 false 0.0 1 1 421 18 false 0.0 1 > df2 concept 0 A 1 B How do…
brucezepplin
  • 7,402
  • 18
  • 68
  • 115
214
votes
4 answers

How to keep the local file or the remote file during merge using Git and the command line?

I know how to merge modification using vimdiff, but, assuming I just know that the entire file is good to keep or to throw away, how do I do that? I don't want to open vimdiff for each of them, I change want a command that says 'keep local' or…
e-satis
  • 515,820
  • 103
  • 283
  • 322
211
votes
4 answers

Git diff between current branch and master but not including unmerged master commits

I want a diff of all changes in a branch that is not merged to master yet. I tried: git diff master git diff branch..master git diff branch...master However, in each of these cases the diff contains content in master that has not been merged into…
pillarOfLight
  • 7,182
  • 15
  • 51
  • 82
209
votes
5 answers

Rebasing a Git merge commit

Take the following case: I have some work in a topic branch and now I'm ready to merge back to master: * eb3b733 3 [master] [origin/master] | * b62cae6 2 [topic] |/ * 38abeae 1 I perform the merge from master, resolve the conflicts and now…
jipumarino
  • 2,093
  • 2
  • 13
  • 5
205
votes
3 answers

Why is a 3-way merge advantageous over a 2-way merge?

Wikipedia says a 3-way merge is less error-prone than a 2-way merge, and often times doesn't need user intervention. Why is this the case? An example where a 3-way merge succeeds and a 2-way merge fails would be helpful.
Johannes Bittner
  • 2,775
  • 2
  • 20
  • 18