![]() ![]() $ git config –global ‘C:\Program Files\Perforce\p4merge.exe’ #P4MERGE AS MERGETOOL GIT WINDOWS#Thanks to these for Windows we can setup p4merge as our merge and diff tools using Git Shell (I’m using Git Bash) I’ll assume you have p4merge installed here in C:\Program Files\Perforce But why can’t you have it all on the same line? What am I missing?Īnd also, what is “mergetool”? is it yet another variable? and how does it differ from merge.tool? ![]() Set up a merge wrapper script named extMerge that calls your binary with all the arguments provided ![]() So why need two lines? Perhaps I’m not recalling enough of my shell programming or the translation fails over to Windows? The instructions say 'extMerge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"' These are the two lines I get stuck on: $ git config -global merge.tool extMerge The journey to 3rd degree black belt starts with a single punch. Yes I know there are others, but for now, I’m going to follow these instructions. I’m going to assume you’ve installed p4merge. Let’s start by engaging in epic battle with the git-scm instructions. The mentor wizard person (because there’s always a mentor wizard person) would tell you, “Aren’t you strong enough to defeat the DragonLord?”Īs I debated whether I knew enough to write a tip about configuring your git diff and merge tools, I ask myself “Aren’t you strong enough to defeat the git diff merge config tool?!”įor today’s tip, I’m using the git-scm instructions and this translation for Windows At level 30, you couldn’t gain any more experience points. ![]() Ĭmd = $HOME/dotfiles/tools/merge-wrapper.One of my favorite Nintendo NES games was Dragon Warrior. You can add the below to your ~/.gitconfig file and when you use git difftool our new merge-wrapper will be used to pick diff tools based on file extension. Say we placed our merge script in the following directory: $HOME/dotfiles/tools/merge-wrapper.js. #P4MERGE AS MERGETOOL GIT HOW TO#Now that we've created our merge wrapper script we need to tell git how to use it. I'd be happy to take contributions of other diff tools in this gist if you leave a comment with yours.īelow was an attempt at using a bash script to manage what I do above, it'll work for some, but I didn't want to maintain this - prefer the JS version instead. Leave me a comment (either here - or in the gist) of what diff tool you added. If you want to change which tool is used per file extensions you can modify the diffLookup hash to map various extensions to whatever tool you setup. Modify which diff tool is used per extension: If you want to extend the script to add support for your own diff tool, just create a new function that returns an object following the pattern of the existing createP4MergeCommand or createOpenDiffCommand. I haven't yet tried to run this on windows, but suspect we can wrap the merge-wrapper.js in a. js version (above that) since it is easier for me to maintain. sh file (bottom), but changed over to the. Below I have 2 samples of a merge script. To allow us the flexibility we want to determine which diff tool should be used for different file extensions, we need to break out the logic in to an external script. I'm going to put this here so I can find it later. How to setup git to allow different merge/diff tools based on file extension. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |