1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WSL2環境のGitでp4mergeを使用する

Last updated at Posted at 2022-10-15

はじめに

WSL2環境でp4mergeを使用するときに設定に少し手間取ったのでメモ

git configの設定

p4merge設定用 git configコマンド
// diffで使用するツールを指定
git config --global diff.tool p4merge

// difftoolで実行するexeのパスを設定
git config --global difftool.p4merge.cmd '/mnt/c/Program\ Files/Perforce/p4merge.exe $(wslpath -aw $LOCAL) $(wslpath -aw $REMOTE)'

// difftoolを実行した際に表示されるプロンプトを表示しないようにする設定
git config --global difftool.prompt false

// mergeで使用するツールを指定
git config --global merge.tool p4merge

// mergetoolで実行するexeのパスを設定
git config --global mergetool.p4merge.cmd '/mnt/c/Program\ Files/Perforce/p4merge.exe $(wslpath -aw $LOCAL) $(wslpath -aw $REMOTE) $(wslpath -aw $BASE) $(wslpath -aw $MERGED)'

// mergetoolを実行した際に表示されるプロンプトを表示しないようにする設定
git config --global mergetool.prompt false

.gitconfigがこのようになっていればOK

.gitconfig
[diff]
	tool = p4merge
[difftool "p4merge"]
	cmd = /mnt/c/Program\\ Files/Perforce/p4merge.exe $(wslpath -aw $LOCAL) $(wslpath -aw $REMOTE)
[difftool]
	prompt = false
[merge]
	tool = p4merge
[mergetool "p4merge"]
	cmd = /mnt/c/Program\\ Files/Perforce/p4merge.exe $(wslpath -aw $LOCAL) $(wslpath -aw $REMOTE) $(wslpath -aw $BASE) $(wslpath -aw $MERGED)
[mergetool]
	prompt = false
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?