Visual Studio Code作为git merge tool

经过漫长的等待,终于在vscode insider,加入了merge tool的功能

https://github.com/microsoft/vscode/issues/5770

 

[merge]
	tool = code-insiders
[mergetool]
	writeToTemp = true
	keepBackup = false
[mergetool "code-insiders"]
	cmd = code-insiders --wait -m $REMOTE $LOCAL $BASE $MERGED

你们需要下载最新的vscode

Landed in todays insider as:

-m --merge <path1> <path2> <base> <result> Perform a three-way merge by providing paths for two modified versions of a file, the common origin of both modified versions and the output file to save merge results
In order to use it for git, you also need to add the --wait parameter, e.g.

[merge]
    tool = code-insiders
[mergetool]
    writeToTemp = true
    keepBackup = false
[mergetool "code-insiders"]
    cmd = code-insiders --wait -m $REMOTE $LOCAL $BASE $MERGED
You can give our preview releases a try from: https://code.visualstudio.com/insiders/

I suggest to open new issues for issues found and close this one. One feature request on my backlog is to allow to provide labels for the $REMOTE and $LOCAL version to better identify both sides. If someone knows if Git provides good names with some trick or script, please let me know.

 

 

如果你要设置为diff工具,命令为:

/usr/local/bin/code-insiders  --diff ${leftFile} ${rightFile}

分类: 默认 标签: 发布于: 2022-07-19 14:50:33, 更新于: 2022-07-19 15:01:09