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.
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.
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
# 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"
references
- https://stackoverflow.com/questions/4955752/set-git-diff-to-a-default-value
- https://stackoverflow.com/questions/34119866/setting-up-and-using-meld-as-your-git-difftool-and-mergetool
- https://stackoverflow.com/questions/7897517/why-does-git-difftool-not-open-the-tool-directly
- https://stackoverflow.com/questions/1220309/git-difftool-open-all-diff-files-immediately-not-in-serial