When using WinSCP, we can define customized commands to do task, like to compare file contents.
The built-in one is:
cmd /c fc "^!^" "!" | more && pause
using the Windows fc
(file compare) utility.
Now, I use TortoiseMerge
of TortoiseSVN to compare file content and it is perfect. I think it is the best free text compare software in Windows, and it allows us to specify the files to compare upon launch. Actually, I use this line in my git-bash
config file to use TortoiseMerge
to do git diff
:difftool.tortoisediff.cmd="C:\some\path\TortoiseSVN\bin\TortoiseMerge.exe" -mine $REMOTE -base $LOCAL
.
So, can I combine WinSCP with TortoiseMerge
, to enable side-by-side edition? I think with that enabled, WinSCP can beat Beyond Compare, which is licensed and not free.
After some time trial-and-error, I find the correct syntax.
For uploading code to remote:
For downloading code to local:
"!^!"
represents local file, and"!"
represents remote file.Remember that in TortoiseMerge we define the left side as the "base", and we can only copy code from left side to right side, so for uploading and downloading, we reverse the position of local and remote file.
To use these commands, we open "File" - "File Custom Commands" - "Customize..", and "New" a command, and "Save". At last, we activate the Command toolbar to show buttons above working area. You can define the name of these two commands as you like, like "Diff commit"/"Diff clone", or "Diff push"/"Diff pull".
At last: select the local and remote files at the same time to make the button available.