Meld:一款强大的视觉差异与合并工具
> https://zhuanlan.zhihu.com/p/656795584
------
> https://download.gnome.org/sources/meld/
绿色免安装 OK > https://gitlab.gnome.org/GNOME/meld
linux 免安装版本 > https://meldmerge.org/ << 来历不明?
git clone https://gitlab.gnome.org/GNOME/meld.git
bin/meld
在 git-cola 中,默认自带的工具
使git diff对比走meld
> ubuntu git diff使用meld工具进行对比_ubuntu git diff meld-CSDN博客
git config --global diff.external meld
> Meld:一款代码对比神器的安装及使用_meld代码对比-CSDN博客
- Meld 主要是作为文件、或文件夹的差异比对。
- Meld 的版本控制部分,只有最基本的几种功能。git 仓库的配置和设置,需要在 Meld 工具之外、采用其他工具来完成。
中 | BASE (共同祖先) | 冲突根源,灰色背景锁定 |
Meld 的三向合并功能如何使用?
界面解析(三窗格视图)
窗格位置 | 内容 | 作用 |
---|---|---|
左 | LOCAL (当前分支) | 展示你的修改 |
中 | BASE (共同祖先) | 冲突根源,灰色背景锁定 |
右 | REMOTE (目标分支) | 他人/其他分支的修改 |
- 底部输出窗格:实时显示合并结果(编辑后保存同步至版本库)
扩展应用
- 目录级三向合并:比较冲突目录结构,可视化同步文件增删/重命名操作
- 版本溯源:右键文件 → Blame View 定位修改者,辅助判断代码意图
- CI/CD 集成:通过
meld --auto-merge
脚本处理低级冲突(需预测试)
提示:高冲突率项目建议结合
git rerere
自动记录解决方案,减少重复操作 。
Using Meld with Version Control
- 前置条件?:必须使用其他工具,配置好 git 可用。Meld 只有一部分、非完整的 git 功能?
- git-cola 内置了 Meld 和版本控制功能;因此,只有在需要比较,特别是 3路比较的场合,才需要 meld?
Viewing version-controlled files
Meld integrates with many version control systems to let you review local changes and perform simple version control tasks. You can start a new version control comparison using the new comparison button on the toolbar, and clicking on the Version Control tab.
查看版本控制文件
Meld与许多版本控制系统集成,使你可以查看本地更改并执行简单的版本控制任务。您可以使用工具栏上的新比较按钮开始新的版本控制比较,然后单击版本控制选项卡。
Version control comparisons
Version control comparisons show the differences between the contents of your folder and the current repository version. Each file in your local copy has a state that indicates how it differs from the repository copy.
If you want to look at a particular file's differences, you can select it and press Enter, or double-click the file to start a file comparison. You can also interact with your version control system using the Changes menu.
版本控制比较
版本控制比较显示了文件夹内容与当前存储库版本之间的差异。本地副本中的每个文件都有一个状态,指示它与存储库副本的不同之处。
如果要查看特定文件的差异,可以选择它并按Enter键,或双击该文件以开始文件比较。您还可以使用“更改”菜单与版本控制系统进行交互。
Version control states
Each file or folder in a version control comparison has a state, obtained from the version control system itself. Meld maps these different states into a standard set of very similar concepts. As such, Meld might use slightly different names for states than your version control system does. The possible states are:
版本控制状态
版本控制比较中的每个文件或文件夹都有一个状态,该状态是从版本控制系统本身获得的。Meld将这些不同的状态映射到一组非常相似的概念中。因此,Meld可能会使用与版本控制系统略有不同的州名称。可能的状态包括:
Version control states
State | Appearance | Meaning |
Same | Normal font | The file/folder is the same as the repository version. |
Modified | Red and bold | This file is different to the repository version. |
New | Green and bold | This file/folder is new, and is scheduled to be added to the repository. |
Removed | Red bold text with a line through the middle | This file/folder existed, but is scheduled to be removed from the repository. |
Conflict | Bright red bold text | When trying to merge with the repository, the differences between the local file and the repository could not be resolved, and the file is now in conflict with the repository contents |
Missing | Blue bold text with a line through the middle | This file/folder should be present, but isn't. |
Ignored | Grayed out text | This file/folder has been explicitly ignored (e.g., by an entry in .gitignore) and is not being tracked by version control. |
Unversioned | Grayed out text | This file is not in the version control system; it is only in the local copy. |
Error | Bright red with a yellow background and bold | The version control system has reported a problem with this file. |
Version control state filtering
Most often, you will only want to see files that are identified as being in some way different; this is the default setting in Meld. You can change which file states you see by using the Version Filters button on the toolbar and selecting Flatten Folders and selecting the Modified, Normal, Unversioned and Ignored buttons on the toolbar.
版本控制状态过滤
大多数情况下,您只想看到以某种方式标识为不同的文件;这是Meld中的默认设置。通过使用工具栏上的“版本过滤器”按钮,选择“展平文件夹”,然后选择工具栏上的已修改、正常、未变形和忽略按钮,可以更改所看到的文件状态。
Resolving merge conflicts
One of the best uses of Meld is to resolve conflicts that occur while merging different branches.
For example, when using Git, git mergetool will start a 'merge helper'; Meld is one such helper. If you want to make git mergetool use Meld by default, you can add
[merge]
tool = meld
to .git/gitconfig. See the git mergetool manual for details.
解决合并冲突
Meld的最佳用途之一是解决合并不同分支时发生的冲突。
例如,在使用Git时,Git mergetool将启动一个“合并助手”;梅尔德就是这样一个帮手。如果你想让git mergetool默认使用Meld,你可以添加
[merge] tool = meld
转到.git/gitconfig。有关详细信息,请参阅git mergetool手册。
Flattened view
When viewing large folders, you may be interested in only a few files among the thousands in the folder itself. For this reason, Meld includes a flattened view of a folder; only files that have not been filtered out (e.g., by Version control state filtering) are shown, and the folder hierarchy is stripped away, with file paths shown in the Location column.
You can toggle the flattened view on or off using the Version Filters button on the toolbar and selecting Flatten Folders.
平面视图
查看大型文件夹时,您可能只对文件夹中数千个文件中的少数几个感兴趣。因此,Meld包括文件夹的平面视图;仅显示未被过滤掉的文件(例如,通过版本控制状态过滤),并剥离文件夹层次结构,文件路径显示在“位置”列中。
您可以使用工具栏上的“版本过滤器”按钮并选择“展平文件夹”来打开或关闭展平视图。
Supported version control systems
Meld supports a wide range of version control systems:
-
Bazaar
-
Darcs
-
Git
-
Mercurial
-
SVN
Less common version control systems or unusual configurations may not be properly tested; please report any version control support bugs to the Meld issue tracker.