Kaloyan Roussev
Kaloyan Roussev

Reputation: 14711

How to work with a git patch file and how to tell git bash I want to use a diff tool?

I am at a beginner level using Git.

I have these two branches:

develop
*test

I am on test now and I want to rebase develop, so I did

git rebase develop

There were some merge conflicts, so git told me that it created a patch file in .git/rebase-apply/patch

I opened that file and I saw a bunch of conflicts there. What do I do next?

How to make git bash open a git diff tool next time it encounters merge conflicts? Which diff tool should I install for windows?

EDIT:

So this is a part of the patch file:

diff --git a/app/src/main/java/com/example/android/app/MainActivity.java 
b/app/src/main/java/com/example/android/app/MainActivity.java
index 36c85c8d1f780dd7b0a6dacada717524e95bf7d4..174badb785e6f28b0d9ecd32164a7153b5f2acd5 100755
--- a/app/src/main/java/com/example/android/app/MainActivity.java
+++ b/app/src/main/java/com/example/android/app/MainActivity.java
@@ -393,7 +393,7 @@ public class MainActivity extends BaseActivity
      */
     public void showLoginFragment(boolean setAsActive) {

-        showFragment(LoginFragment_.builder().setAsActive(setAsActive)
+        showFragment(LandingFragment_.builder().setAsActive(setAsActive)
                 , true
                 , "login"
                 , true

Suppose I want to remove the LoginFragment line and leave the LandingFragment line, I have to delete the entire line(along with the - sign) and then save the file, right?

EDIT2: Turns out I have kdiff installed. How do I tell Git to use it instead of making me go through a patch file?

Upvotes: 0

Views: 58

Answers (1)

Deb
Deb

Reputation: 2972

Suppose you have conflicted in test.txt file.

You should open the test.txt file and solve the conflicts(Keep the line you wanted and remove any unwanted line from the file) manually. After solving the conflict's add the file using git add <path to that file> then run git rebase --continue

meld is pretty good diff tool. Installation and other description you can find it in http://meldmerge.org/

Upvotes: 1

Related Questions