Questions tagged [git-merge]

git-merge is a git command which integrates changes from another branch by incorporating commits into the currently checked-out branch.

A merge in version control is an operation where two sets of changes are combined to have both features available.

Git provides sophisticated merge support by automatically detecting simple merges (i.e. if only changes on one branch happened, also called fast-forward) and allowing plugable merge-strategies for more advanced use-cases.

3320 questions
405
votes
12 answers

How do I finish the merge after resolving my merge conflicts?

I've read the Basic Branching and Merging section of the Git Community Book. So I follow it and create one branch: experimental. Then I: switch to experimental branch (git checkout experimental) make a bunch of changes commit it (git commit…
michael
  • 106,540
  • 116
  • 246
  • 346
392
votes
8 answers

How to keep a branch synchronized/updated with master?

At the moment git is doing my head in, I cannot come up with the best solution for the following. There are two branches, one called master and one called mobiledevicesupport. I want to keep mobiledevicesupport as a continuous branch that will be…
Mr. EZEKIEL
  • 4,084
  • 3
  • 14
  • 9
373
votes
14 answers

How do I 'overwrite', rather than 'merge', a branch on another branch in Git?

I have two branches, email and staging. staging is the latest one and I no longer need the old changes in email branch, yet I don't want to delete them. So I just want to dump all the contents of staging into email so that they both point to the…
Rafid
  • 18,991
  • 23
  • 72
  • 108
347
votes
21 answers

Git error on commit after merge - fatal: cannot do a partial commit during a merge

I ran a git pull that ended in a conflict. I resolved the conflict and everything is fine now (I used mergetool also). When I commit the resolved file with git commit file.php -m "message" I get the error: fatal: cannot do a partial commit during a…
pMan
  • 8,808
  • 11
  • 32
  • 35
342
votes
8 answers

Git merge errors

I have a git branch called 9-sign-in-out with perfectly working code, and I want to turn it into the master. I'm currently on the master branch. $ git branch 9-sign-in-out * master I'm trying to switch to 9-sign-in-out branch, but it doesn't allow…
Sayanee
  • 4,957
  • 4
  • 29
  • 35
334
votes
9 answers

Re-doing a reverted merge in Git

I have run into a bit of a problem here: I had a problem-specific branch 28s in Git, that I merged in the general develop branch. Turns out I had done it too fast, so I used git-revert to undo the merge. Now, however, the time has come to merge 28s…
Toms Mikoss
  • 9,097
  • 10
  • 29
  • 41
330
votes
4 answers

Find unmerged Git branches?

I have a Git repository with many branches, some of them already merged and some not. Since the number of branches is quite large, how can I determine which branches have not yet been merged? I would like to avoid having to do an "octopus" merge and…
fluca1978
  • 3,968
  • 2
  • 15
  • 15
291
votes
15 answers

How to merge specific files from Git branches

I have 2 git branches: branch1 branch2 I want to merge all the history (multiple commits) of file.py in branch2 into file.py in branch1 and only that file. In essence I just want to work on the file.py in branch1 but want to take advantage of the…
rwolst
  • 12,904
  • 16
  • 54
  • 75
283
votes
8 answers

How can I configure KDiff3 as a merge tool and diff tool for git?

Recently I was using GitExtension 2.46, but the Git version that has the same is 1.9.4.msysgit.2. Willing to use only Git commands, I uninstalled GitExtension and install the latest version available of Git and KDiff3. When I make a merge and have…
Jose Rodriguez
  • 9,753
  • 13
  • 36
  • 52
283
votes
4 answers

How do I fix a merge conflict due to removal of a file in a branch?

I have create a dialog branch and when I try to merge it to master branch. There are 2 conflicts. I don't know how to resolve CONFLICT (delete/modify). Can you please tell me what to do? $ git checkout master $ git merge dialog CONFLICT…
n179911
265
votes
3 answers

Abort a Git Merge

I am working on a project using Git as the VCS. I got a branch xyz cut from the mainline branch of master. After working for a while, I committed my code and took a pull of the branch mainline. The pull was fine. I then merged the code with master.…
Salman Kazmi
  • 3,038
  • 4
  • 21
  • 32
264
votes
9 answers

Merge stashed change with current changes

I made some changes to my branch and realized I forgot I had stashed some other necessary changes to the said branch. What I want is a way to merge my stashed changes with the current changes. Is there a way to do this? It’s more for convenience, I…
Bemis
  • 3,092
  • 2
  • 17
  • 24
260
votes
1 answer

Restart/undo conflict resolution in a single file

In a larger git merge with several conflicting files, I incorrectly marked a file as resolved (using git add FILE after some editing) Now I'd like to undo my conflict resolution attempt and start over resolving that file. How can I do that?
Alex Krauss
  • 9,438
  • 4
  • 27
  • 31
249
votes
7 answers

Git merge error "commit is not possible because you have unmerged files"

I forgot to git pull my code before editing it; when I committed the new code and tried to push, I got the error "push is not possible". At that point I did a git pull which made some files with conflict highlighted. I removed the conflicts but I…
Kiarash
  • 7,378
  • 10
  • 44
  • 69
245
votes
6 answers

How do I merge a git tag onto a branch

I'm trying to find the syntax for merging a tagged commit onto another branch. I guess it's straightforward but my feeble search attempts aren't finding it.
Jeremy Woodland
  • 3,444
  • 5
  • 17
  • 25