Messing around with the Linux-5-GitMerge tool Meld gracefully

The article was originally published in the Third Frontier Research Institute of szhshp 
. Please indicate

You really don't need a Git Merge Tool?

Git 's command line to view diffs is sometimes very tasteless.

Screenshot from 2017-07-01 23-04-17.png

Windows is used to using TortoiseGit for various Merge operations, and Linux should also prepare one.

Install

One line of code to solve all problems

sudo apt-get install meld

use

Under normal circumstances, entering meld will open an empty view

Of course, if you add a repo path later, you can view the corresponding diff

Step1: Set Git default difftool to meld

Set meld as the default difftool

git config --global diff.tool meld

In addition, if you want to change other tools later, just change the meld

After running:

git difftool

The diff view will be performed on the current repo. Of course, meld can perform the merge operation at the same time.

Screenshot from 2017-07-01 23-04-39.png

Step2: Cancel the verification popup of difftool/diff without prompt

Command to view all difftool parameters

man git-difftool

OPTIONS
   -y, --no-prompt
   Do not prompt before launching a diff tool.

Simple and easy to understand, just add a -y parameter after

git difftool -y

Step3: Diff/Merge the entire repo using Meld

But it is still very troublesome because the meld corresponding to multiple files will pop up in turn, so I searched again how to diff the entire folder at one time

The answer is also simple

Starting with git v1.7.11, you can use git difftool –dir-diff to perform a directory diff.

The answer that follows applies to git installations older than v1.7.11.

So the final diff command becomes:

git  difftool  -y- -dir _ _  _

Step Extra: Simplified command

This command is too troublesome, and there are still three parameters that I can't remember at all.

ZSH:  (:з"∠) Hehe

Open the ZSH configuration file:

gedit ~/.zshrc

Then add a line below alias:

# Example aliases
# alias ohmyzsh="mate ~/.oh-my-zsh"
alias jkl='jekyll s'
alias subl='LD_PRELOAD=./libsublime-imfix.so subl'
alias gdiff="git difftool -y --dir"

Of course, the aliases here can be changed at will. After modification, save and reopen Terminal, you can use gdiff to diff and merge the current repo.

Screenshot from 2017-07-01 23-07-49.png

references

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326361829&siteId=291194637