Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you merge in GIT on Windows?

I tried to use GIT however for me the biggest problem with it is that there is no tool for merge'ing. At least the msysgit does not give me anything. How can I merge in GIT? Are there any great tools for it or do I have to use WinMerge or application like that?

I use Java and Eclipse.

like image 851
IAdapter Avatar asked Feb 10 '11 13:02

IAdapter


People also ask

How do I merge one branch to another?

Select the branch that you want to merge into the current branch, click Modify options and choose from the following: --no-ff : a merge commit will be created in all cases, even if the merge could be resolved as a fast-forward. --ff-only : the merge will be resolved only if it is possible to fast-forward.

What is another option for merging in git?

Using git rebase Instead of git merge. Using the "git merge" command is probably the easiest way to integrate changes from one branch into another. However, it's not your only option: "git rebase" offers another, slightly different way of integration.


2 Answers

I suggest kdiff3. Install it and put something like:

[merge]         tool = kdiff3 [mergetool "kdiff3"]         path = c:/Program Files (x86)/KDiff3/kdiff3.exe [diff]         tool = kdiff3         guitool = kdiff3 [difftool "kdiff3"]         path = c:/Program Files (x86)/KDiff3/kdiff3.exe 

in your .gitconfig

To edit the global config (.gitconfig): git config --global --edit

The installation path on your machine may be different from c:/Program Files (x86)/KDiff3/kdiff3.exe. Replace that string above with actual path to your kdiff3 binary. And don't forget you have to use forward slashes, /, and not backward ones (\) like native programs usually do.

like image 53
Jan Hudec Avatar answered Oct 01 '22 05:10

Jan Hudec


For me (windows xp, kdiff3 0.9.96 and git 1.7.5.1), Jan Hudec's answer did not work. Here is my setup:

[diff]         tool = kdiff3         guitool = kdiff3  [difftool]         prompt = false  [difftool "kdiff3"]         path = /home/username/bin/difftool-kdiff3.sh 

and

#!/bin/sh  # Passed the following parameters from git #  --auto --L1 "somefile (A)" --L2 "somefile (B)" /tmp/4VhUw0_somefile somefile  LOCAL=$6 REMOTE=$7  "C:/Program Files/KDiff3/kdiff3.exe" $(cygpath -w "$LOCAL") "$REMOTE" 
like image 29
hlovdal Avatar answered Oct 01 '22 04:10

hlovdal