- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
有没有办法在 git 中使用 Winmerge 来做 Diffs?
最佳答案
2015 年 6 月更新,6 年后:
如“git mergetool winmerge”中所述,一个简单的 git config diff.tool winmerge
就足够了。
Git 2.5+(2015 年第 2 季度)现在将 Winmerge 识别为差异或 merge 工具!
原始答案(2009-2012)
(msysgit,1.6.5,DOS session )
第一部分(使用 winmerge)在“How do I view ‘git diff’ output with visual diff program?”中描述
C:\myGitRepo>git config --replace --global diff.tool winmerge
C:\myGitRepo>git config --replace --global difftool.winmerge.cmd "winmerge.sh \"$LOCAL\" \"$REMOTE\""
C:\myGitRepo>git config --replace --global difftool.prompt false
将 winmerge.sh
存储在 PATH
的目录部分:
#!/bin/sh
echo Launching WinMergeU.exe: $1 $2
"$PROGRAMFILES/WinMerge/WinMergeU.exe" -e -u -dl "Local" -dr "Remote" "$1" "$2"
(参见 WinMerge Command-line options)
git difftool
现在将启动 WinMerge。
如果您希望 git diff
启动 WinMerge,只需设置:
set GIT_EXTERNAL_DIFF=winmerge.sh
但真正的附加值来自于使用相同的差异工具在一批中显示所有差异的能力,而不是按顺序显示它们,迫使您一次关闭一个文件的差异工具窗口时间。
2012 年 6 月更新(两年半后):
比较目录而不是逐个文件将很快可用:
参见 [ANNOUNCE] Git 1.7.11.rc1 :
"
git difftool
" learned the "--dir-diff
" option to spawn external diff tools that can compare two directory hierarchies at a time after populating two temporary directories, instead of running an instance of the external tool once per a file pair.
有关详细信息,请参阅“ Patch difftool
: teach difftool
to handle directory diffs ”和答案“Directory comparison of Git branches”。
目录脚本的原始 difftool(2009 年 12 月)
作为Seba Illingworth在 his answer 中提到,脚本 git-diffall.sh(也放在路径中)可以做到这一点:
#!/bin/sh
git diff --name-only "$@" | while read filename; do
git difftool "$@" --no-prompt "$filename" &
done
但这只能通过为 n 个文件打开 n 个窗口来实现(如果您尝试使用 WinMerge 的 -s
选项,它将由于 difftool 过早删除临时文件而无法工作)
这就是为什么我喜欢 GitDiff.bat - power-diffing with GI 的方法,它允许您在选择一个文件以检查其内部差异之前查看有差异的文件列表。
我已将其调整为仅使用 DOS 命令
@echo off
setlocal
if "%1" == "-?" (
echo GitDiff - enables diffing of file lists, instead of having to serially
echo diff files without being able to go back to a previous file.
echo Command-line options are passed through to git diff.
echo If GIT_FOLDER_DIFF is set, it is used to diff the file lists. Default is windff.
goto END
)
if "%GIT_DIFF_COPY_FILES%"=="" (
rd /s /q %TEMP%\GitDiff
mkdir %TEMP%\GitDiff
mkdir %TEMP%\GitDiff\old
mkdir %TEMP%\GitDiff\new
REM This batch file will be called by git diff. This env var indicates whether it is
REM being called directly, or inside git diff
set GIT_DIFF_COPY_FILES=1
set GIT_DIFF_OLD_FILES=%TEMP%\GitDiff\old
set GIT_DIFF_NEW_FILES=%TEMP%\GitDiff\new
set GIT_EXTERNAL_DIFF=%~dp0\GitDiff.bat
echo Please wait and press q when you see "(END)" printed in reverse color...
call git diff %*
if defined GIT_FOLDER_DIFF (
REM This command using GIT_FOLDER_DIFF just does not work for some reason.
%GIT_FOLDER_DIFF% %TEMP%\GitDiff\old %TEMP%\GitDiff\new
goto END
)
if exist "%ProgramFiles%\Beyond Compare 2\BC2.exe" (
set GIT_FOLDER_DIFF="%ProgramFiles%\Beyond Compare 2\BC2.exe"
"%ProgramFiles%\Beyond Compare 2\BC2.exe" %TEMP%\GitDiff\old %TEMP%\GitDiff\new
goto END
)
"%ProgramFiles(x86)%\WinMerge\WinMergeU.exe" -r -e -dl "Local" -dr "Remote" %TEMP%\GitDiff\old %TEMP%\GitDiff\new
goto END
)
REM diff is called by git with 7 parameters:
REM path old-file old-hex old-mode new-file new-hex new-mode
copy %TEMP%\%~nx2 %GIT_DIFF_OLD_FILES%\%1
copy %5 %GIT_DIFF_NEW_FILES%
:END
它不够健壮,无法处理不同目录中具有相同名称的文件,但它可以让您大致了解可能发生的情况:
这里只会打开一个 WinMerge,其中包含内部差异的文件列表。您可以单击要检查的那些,然后一个简单的 ESC 将关闭所有 WinMerge-diff
session 。
关于git - 在 Git 中使用 Winmerge 来归档差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1881594/
我开始使用 WinMerge。我希望看到行号以便在文件中轻松导航。我找不到选项。 有人知道我可以在哪里打开它,或者有可能吗? 最佳答案 Menu > View > View Line Numbers
TL;DR:我如何才能自动对所有差异结果应用 PrediffLineFilter,而不是仅对打开的文件手动应用? WinMerge 2.16.4.0 支持使用插件 prediffers 等 diff,
动机:我正在重写一个文档——稍后要处理的文本文件。新源现在使用 UTF-8。大部分来源是相同的。我需要找到差异。 详细信息:旧的文档源使用 cp1250 编码,新源使用 UTF-8。新旧源都使用相同的
当我比较2个大文件时 我用了winmerge这是一个很好的工具,可以找到2个文件之间的差异 就我而言 2个文件中的每一个几乎包含3000行 而且有些行只包含更改 有什么办法可以使两个文件中的相同行在比
我正在使用 WinMerge 来比较文件夹(包括子文件夹)中的 java 文件。我想在比较完成后忽略评论,但我不知道该怎么做。 在文件级别,我在选项中找到了一个开关,因此如果我比较两个文件,注释将被忽
使用 WinMerge 时,我正在查看一个文件,该文件已将一段代码插入函数中,这会导致文件的其余部分在比较中不同步。我的要复杂得多,但与下面的简单示例基本相同: FILE 1
我想使用 winmerge 合并两个包含 android 项目的目录。我只想合并源文件(.java),资源文件(布局/值/可绘制) 任何人都可以帮助我了解 fileter 的规则。这是我第一次使用 w
我有一个代码目录结构,它是这样的: modudle1 trunk pom.xml branches 1.1 pom.xml modudl
我有很多文件包含以下类型的行 - * @version $Revision: 1.xxx 我希望在使用 winmerge 进行比较时忽略这种类型的行。我尝试过使用线路过滤器。但是,直到无法做到这一点
我已经阅读了关于这个主题的大量问答,并严格按照所有说明进行操作。但是,尝试使用 WinMerge 将 Git 设置为比较和 merge 时,我仍然感到头疼。 我使用 Git 终端执行了以下步骤: gi
我喜欢用 WinMerge而不是使用 TortoiseSVN 的 TortoiseMerge 来比较文件的不同修订版之间的更改。我可以在 TortoiseSVN 设置(上下文菜单>“TortoiseS
我需要一个助手在 python 中对两个表之间的比较进行编码,目前在 winmerge 中完成。 代码如下 import pandas as pd 上周的表 df1=pd.read_csv(r"C:\
是否有可能仅复制两个文件的差异?就像在 winmerge 中一样,但是,我找不到此选项 就像在这个屏幕上一样 - 我只想复制“黄色部分”。当然我可以手动完成,但在大文件中它不是太有趣:-) 最佳答案
当我在 Windows 平台上用 WinMerge 比较 2 个文件时,你知道我怎么能忽略特定的词吗? 我的意思是我想对 WinMerge 说:“不要在意那些单词列表:房子、花园等。” 比较这两行时,
经过多年的备份和将大量目录从一台计算机复制到另一台计算机后,我的皇室一团糟。 Duplicate finder 软件和 winmerge 想要通过浏览单个文件来解决问题。考虑到问题的规模,搜索或扫描需
我正在尝试使用 WinMerge 递归比较两个 Subversion 工作副本文件夹。 不幸的是,WinMerge 在 Subversion Control 文件夹( .svn 或 _svn )中显示
我试图找到 WinMerge 的替代方案来解决 150% DPI 下的文本模糊问题。虽然我的问题被关闭了(我认为这种心态没有帮助),但我找到了答案所以我分享它。 最佳答案 您可以继续使用 WinMer
我有两个目录,其中包含一些 *.jar 和 *.war 文件,以及一些元数据文件和一个带有 *.spring 扩展名的文件,它实际上只是一个名称奇怪的 zip 文件。像这样的: - dist1
当您在 TortoiseSVN 之后安装 winmerge 时,它会为您提供将 winmerge 与 Tortoise 相关联的选项。但是,如果我们在 winmerge 之后安装 Tortoise
我可以让 winmerge 显示修改文件的差异。但是对于新文件,winmerge 会给出一个对话框,提示“左路径无效!”。我希望它将左 Pane 显示为空,右 Pane 显示文件内容。 $ git d
我是一名优秀的程序员,十分优秀!