How to use WinMerge with "Github for Windows" - github-for-windows

I use "Github for Windows" as the git client (and use it with an enterprise github server). Is it possible to configure using WinMerge to be used with this client? I have not seen a setting for setting up any GUI diff tool for that matter.

In C:\Users"name of user" folder open file .gitconfig and write
[merge]
tool = winmerge
[mergetool]
prompt = false
keepBackup = false
keepTemporaries = false
[mergetool "winmerge"]
name = WinMerge
trustExitCode = true
cmd = "\"C:/Program Files (x86)/WinMerge/WinMergeU.exe\" \"$LOCAL\" \"$REMOTE\" \"$MERGED\" >/dev/null 2>&1"
keepBackup=false
Then,
restart github desktop,
in left pannel :
select repository :
right click : Open in Command Prompt.
When the command prompt appears type: git mergetool
If it doesn't work, try : git mergetool –tool=winmerge

Related

How do I use Meld as a merge tool with Sourcetree on Windows?

I have the following in my .gitconfig file:
[user]
name = myname
email = myname#gmail.com
[core]
autocrlf = true
excludesfile = C:\\Users\\myname\\Documents\\gitignore_global.txt
[diff]
tool = meld
[difftool "meld"]
cmd = "C:/Program Files (x86)/Meld/meld/meld.exe"
prompt = false
[merge]
tool = meld
[mergetool "meld"]
cmd = "C:/Program Files (x86)/Meld/meld/meld.exe"
[difftool "sourcetree"]
cmd = "C:/Program Files (x86)/Meld/meld/meld.exe $PWD/$LOCAL $PWD/$BASE $PWD/$REMOTE"
[mergetool "sourcetree"]
cmd = 'C:/Program Files (x86)/Meld/meld/meld.exe' \"$LOCAL\" \"$REMOTE\" \"$MERGED\"
trustExitCode = true
And in Sourcetree, I have the following settings:
However, when I right-clicked a file on Sourcetree to do an external diff, I was able to open Meld, but the contents of the file were not displayed at all.
What have I done wrong in the settings?
I feel the existing answers slightly missed the point. Here is my own dog food:
Arguments Detail:
Diff: $LOCAL $REMOTE
Merge: $LOCAL $BASE $REMOTE --auto-merge --output=$MERGED
For External Diff, you need to remove $BASE from your argument list.
For 3-way merging, you need to click on the External Merge Tool option instead, which will only be available if there are any unsolved conflicts.
If you are not restricted to Sourcetree + Meld, I reckon the Git Extensions + KDiff3 suite could be a good open-sourced alternative also.
The actual setting to use here in order to have a real 3-way merge, with read only THEIRS and MINE tabs is this:
$LOCAL $BASE $REMOTE --auto-merge --output=$MERGED
Note the = after --output.
I've finally got this command right by digging in comments on the second answer to this question Git merging using Meld.
For OS X it looks like this:
Diff Command: /Applications/Meld.app/Contents/MacOS/meld.
Arguments: $LOCAL $REMOTE
Merge Command: /Applications/Meld.app/Contents/MacOS/meld.
Arguments: $LOCAL $BASE $REMOTE --auto-merge --output=$MERGED
P.S.
you might have to configure the order of $local and $ remote in meld prefrences as well..
To use it from command line you have to install it via brew:
brew install meld
Try adding the location of meld.exe to your PATH (e.g. C:\Program Files (x86)\Meld), and then in the Diff Command, just enter meld instead of the full path. See the gist How to use meld with Sourcetree on Windows.
If you don't want to modify the PATH environment variable, you can use the DOS-compatible short names:
C:\Progra~1 = C:\Program Files
C:\Progra~2 = C:\Program Files (x86)
That avoids the trouble-causing spaces in the path and plays nice with Sourcetree. It's hackish, but it works. You can then use something like this as the path to Meld:
C:\Progra~1\Meld\meld.exe
It may not be guaranteed that Progra~1 maps to the 64-bit directory, so you might need to experiment with which one maps to which.

Merging files in Sublime with Sublimerge via command line

I'm trying to find a better merge file option and wanted to try out Sublime as of my work is done using it. so I installed Sublimerge and now am stuck. I know I can compare two already open files or compare via the Sidebar but what I want to do is fire it off via the command line so I can kick it off from our source control program like I can with every other merge tool I've seen. Does anyone know the command line format to do this?
N.B. - I've long since given up trying to use sublime to handle merges and instead switched to other tools to handle this. Therefore I've never felt I can accept any answer as I'm not checking them to see if they work in the way I'd want, or indeed whether they work at all.
subl -n --wait "<LEFT>" "<RIGHT>" --command "sublimerge_diff_views {\"left_read_only\": true, \"right_read_only\": true}"
See "VCS Integration" for details.
As Nickolay already suggested, this is the whole directive you have to put in your ~/.gitconfig:
[merge]
tool = sublimerge
[mergetool "sublimerge"]
cmd = subl -n --wait \"$REMOTE\" \"$BASE\" \"$LOCAL\" \"$MERGED\" --command \"sublimerge_diff_views\"
trustExitCode = false
[diff]
tool = sublimerge
[difftool "sublimerge"]
cmd = subl -n --wait \"$REMOTE\" \"$LOCAL\" --command \"sublimerge_diff_views {\\\"left_read_only\\\": true, \\\"right_read_only\\\": true}\"
Taking jnns' answer, but making appropriate changes for windows.
%USERPROFILE%\.gitconfig:
[merge]
tool = sublimerge
[mergetool "sublimerge"]
cmd = sublime_text -n --wait \"$REMOTE\" \"$BASE\" \"$LOCAL\" \"$MERGED\" --command \"sublimerge_diff_views\"
trustExitCode = false
[diff]
tool = sublimerge
[difftool "sublimerge"]
cmd = sublime_text -n --wait \"$REMOTE\" \"$LOCAL\" --command \"sublimerge_diff_views {\\\"left_read_only\\\": true, \\\"right_read_only\\\": true}\"
note location of .gitconfig
in windows, the executable is sublime_text.exe, NOT subl
don't forget to add sublime text executable to the path
I'm not sure exactly how to do it, but I'm getting closer.
First, you need a handy path to the Sublime binary:
mkdir ~/bin
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Then, in your git GUI or git command line, configure ~/bin/subl as your merge tool.
I use Source Tree, and I haven't figured exactly how to best use Sublimerge, but I managed to open both versions, merge them, and then I have to do a bit of manual work.
Still not smooth, but better than nothing!

How to set xterm-256colors on iTerm2 via script / command line

In iTerm2 we can set the xterm-256color option by going to Preferences -> Profiles -> Terminal -> Terminal Emulation -> Report Terminal Type and chosing xterm-256color
I want to add to my dotfile's installation script so I don't have to change it manually.
Is there a way of setting this option via command line? Maybe via iTerm itself or maybe via apple's defaults write.....
Thank you!
default works only if the setting is a top level key, for example
[admin#mb-125:~] : defaults read com.googlecode.iterm2 | grep -i promptonquit
PromptOnQuit = 1;
[admin#mb-125:~] : defaults write com.googlecode.iterm2 PromptOnQuit -bool FALSE
[admin#mb-125:~] : defaults read com.googlecode.iterm2 | grep -i promptonquit
PromptOnQuit = 0;
xterm-256color is part of a dictionary, and we need to use plistbuddy to change it, here is the command to see the current settings
[admin#mb-125:~] : /usr/libexec/PlistBuddy -c "Print :\"New Bookmarks\":0:\"Terminal Type\"" Library/Preferences/com.googlecode.iterm2.plist
xterm-256color
And this is how you change it from command line
[admin#mb-125:~] : /usr/libexec/PlistBuddy -c "Set :\"New Bookmarks\":0:\"Terminal Type\" xterm" Library/Preferences/com.googlecode.iterm2.plist
[admin#mb-125:~] : /usr/libexec/PlistBuddy -c "Print :\"New Bookmarks\":0:\"Terminal Type\"" Library/Preferences/com.googlecode.iterm2.plist
xterm
In the ~/Library/Preferences folder there's a file called com.googlecode.iterm2.plist. This file contains all your iTerm preferences. What I like to do is keep a copy of that preferences file inside my dotfile repo. When I'm installing on a new system I copy it into ~/Library/Preferences via my installation script .
Hope that helps!

Pretty hg branch graphs

With hg, how I can see in command line the branches graphs? Similar to
git log --pretty=oneline --graph
For Mercurial 2.3 and up, use
hg log -G
For older Mercurial, you need to first install the the graphlog extension which will enable the above command. The graphlog extension also adds an alias
hg glog
in all versions of Mercurial.
You can create custom templates and aliases in hg. For instance, create an alias in your .hgrc as follows:
[alias]
lg = log --template "{label('custom.rev', rev)}\t{label('custom.phase',phase)}\t{label('custom.tag',tags)}\t{desc|firstline} {label('custom.age', date|age)} {label('custom.user', author|user)}\n"
[color]
custom.rev = yellow
custom.phase = bold
custom.user = cyan
custom.age = bold
custom.tag = bold yellow
and invoke it with
hg lg -G
The output will be like this.
Jordi has some awesome aliases in his blog

Setting SVN username (Author Name in Eclipse) when using svn+ssh

When I commit changes in Eclipse, svn records my author name as the one that I entered the first time I committed changes in Eclipse (Alok). By author name, I mean the name that shows up when you run "svn log" or "svn blame".
However, when I commit changes from the command line, the Author Name is set to the username that I use to ssh to the repository (svnadmin). Is there a way to set the equivalent of Author Name/svn username independently of the ssh username from the command line when using svn+ssh? I have tried
svn --username Alok ci
but the username in this case is ignored, and the change is attributed to svnadmin.
It is by design that you cannot change the username for svn+ssh. If you could, you would be able to fake somebody else as the committer - when the SSH key would normally clearly identify yourself as the committer.
So if you want different committer names to show up with svn+ssh, you need to change something on the server:
Create separate remote users, and put your key into the authorized_keys file for the user you want to appear as committer. Alternatively,
Put command= lines into the authorized_keys file of the svnadmin user. The command should read /usr/bin/svnserve -t --tunnel-user Alok; optionally also with a --root option.
One workaround is to first enable editing of revision tags by putting a shell script like the following in hooks/pre-revprop-change
REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"
if [ "$PROPNAME" = "svn:log" ]; then exit 0; fi
if [ "$PROPNAME" = "svn:author" ]; then exit 0; fi
exit 1
Then, after the commit you can change the svn:author with
svn propset --revprop -r1234 svn:author Alok
This does not explain how eclipse is able to set svn:author at commit time without having a pre-revprop-change hook. This solution is a little unsatisfying because it allows any user to change the svn:author of any commit, it would be nice to know what eclipse is actually doing.