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.

24925 questions
362
votes
16 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
  • 32,567
  • 20
  • 113
  • 146
360
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
  • 7,233
  • 12
  • 42
  • 53
340
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
  • 113,384
  • 42
  • 163
  • 163
338
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,859
  • 8
  • 24
  • 33
328
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
  • 297,451
  • 125
  • 333
  • 465
325
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
  • 37,506
  • 41
  • 139
  • 175
315
votes
7 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 I…
brucezepplin
  • 9,202
  • 26
  • 76
  • 129
310
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
  • 15,969
  • 35
  • 115
  • 173
292
votes
5 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
  • 192,085
  • 135
  • 376
  • 510
292
votes
5 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
  • 8,592
  • 15
  • 60
  • 90
278
votes
8 answers

Git merge two local branches

I have branch Master, branchA and branchB. Now I'm working in the branchA and I need to merge branchA with branchB and proceed my work in the branchA. All files are comitted in the branchA and branchB. What's the fast way to implement it?
user3127896
  • 6,323
  • 15
  • 39
  • 65
276
votes
14 answers

Moving Git repository content to another repository preserving history

I am trying to move only the contents of one repository (repo1) to another existing repository (repo2) using the following commands: git clone repo1 git clone repo2 cd repo1 git remote rm origin git remote add repo1 git push But it's not working. I…
Mario
  • 2,803
  • 3
  • 14
  • 11
268
votes
21 answers

Error "Updates were rejected because the remote contains work that you do not have locally"

I'm working on a team with a few developers using Git on Bitbucket. We are all working on a dev branch, not pushing to master until a release. One of the developers committed incorrect code that overwrote my own by accident, and now I am trying to…
thanos
  • 3,203
  • 4
  • 18
  • 27
259
votes
8 answers

Visual Studio Code how to resolve merge conflicts with git?

I tried to merge my branch with another branch and there was a merge conflict. In Visual Studio Code (version 1.2.1) I resolved all of the issues, however when I try to commit it keeps giving me this message: You should first resolve the un-merged…
annedroiid
  • 6,267
  • 11
  • 31
  • 54
257
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,573
  • 2
  • 15
  • 5