Showing posts with label cygwin. Show all posts
Showing posts with label cygwin. Show all posts

Tuesday, April 6, 2010

Using Beyond compare3 as Git diff tool under Cygwin

在Cygwin下使用Beyond compare3(BC3)作用Git的diff工具
分两步走~


step 1.
create new .sh file as Git's diff warpper.
#!/bin/sh
/cygdrive/c/Program\ Files\ \(x86\)/Beyond\ Compare\ 3/BCompare.exe "d:/programs/cygwin$2" "$5"


** please notice here, you need specially make a full path of $2, since BC3 will not find your tmp file under Cygwin path. **
** 注意这里的两个路径,第二个是本地文件,因为是相对路径,BC3可以找到,但第一个是绝对路径指向/tmp/xxx,所以我们要特别指定在windows下的真实路径,而不是cygwin的路径,所以我加上了d:/programs/cygwin。

step 2.
Add this line to .bashrc and run it to configure your Git gloabl variable.
git config --global diff.external /home/z33/git-diff-wrapper.sh


Now you can try git diff whatever your file.

Sunday, April 19, 2009

Create symbol link on Windows

一直在Linux下用symbol link创建链接,实现Apache的DocumentRoot到Developing Directory的链接。每次开新Branch都换一下链接即可。

本以为用cygwin的ln可以解决这个问题,但发现cygwin的ln命令竟然只是创建了一个windows的shortcut。Shit,于是找到了一个替代的方案,使用junction,这是一个介绍:
Windows 2000 and higher supports directory symbolic links, where a directory serves as a symbolic link to another directory on the computer. For example, if the directory D:\SYMLINK specified C:\WINNT\SYSTEM32 as its target, then an application accessing D:\SYMLINK\DRIVERS would in reality be accessing C:\WINNT\SYSTEM32\DRIVERS. Directory symbolic links are known as NTFS junctions in Windows. Unfortunately, Windows comes with no tools for creating junctions—you have to purchase the Win2K Resource Kit, which comes with the linkd program for creating junctions. I therefore decided to write my own junction-creating tool: Junction. Junction not only allows you to create NTFS junctions, it allows you to see if files or directories are actually reparse points. Reparse points are the mechanism on which NTFS junctions are based, and they are used by Windows' Remote Storage Service (RSS), as well as volume mount points.


Using Junction

Usage: [-s]
-s Recurse subdirectories


If you want to create or delete a junction, use Junction like this:

Usage: [-d] []

To delete a junction specify the -d switch and the junction name.


创建出来的symbol link很漂亮,一个像快捷方式的小箭头都没有。

下载地址:
http://technet.microsoft.com/en-us/sysinternals/bb896768.aspx