Yuan Yijun (bbbush) wrote,
Yuan Yijun

Notes about using msysgit in cygwin

今天折腾的结果。我们这组都在用 cygwin git,完全是"个人应用",因为比 vss/SAW 好太多了。

今天的 notes,放宽了 .gitignore (git add -f) 的限制,放宽了 trailing blank (git
commit -n) 的限制。

Msysgit is a work in progress version of git which is not so official
than "cygwin git" but faster.

Do not follow this email if you are still going to use the "cygwin git".

1. Download from http://code.google.com/p/msysgit/ , Install msysgit
to D:/cygwin/opt/Git/ folder, do not create shortcuts, create context
menu of "GitGUI" (handy).

2. Add to .bashrc:

alias git='PATH="/opt/Git/bin:$PATH" git.exe'

3. exit bash and start cygwin again, also restart screen

4. to verify installation is correct, run

git --version
(should say something like git version

git.exe --version
(should say git version 1.5.6)

(To use original git, run git.exe)

5. add to .gitconfig and *every* .git/config

autocrlf = true

6. use these .gitignore files to replace original '*' one, and avoid
using "git add -f" in future
(With ".gitignore" files defined properly, now you can use "git add ."
for new files, or use "git commit -a" for deleted files, etc.)



Debug Server/
Release MinDependency/
Release MinSize/
Release Server/
Unicode Debug/
Unicode Release MinDependency/
Unicode Release MinSize/

Use "git ls-files --others -X .gitignore >> .gitignore" to add more items.

7. commit once for all projects. Line ending and file mode will change
in this commit.

8. To compare speed:
time git status > /dev/null
time git.exe status > /dev/null

9. To list untracked files:
git ls-files --others -X .gitignore

10. note: do not mix use "git" and "git.exe", also remember (again) do
not use "git add -f".

11. Do not use my scripts (~/git-add.sh, git-add-project,
trim-text-files, etc.) any more. If there is error message about
"trailing blanks", just ignore them by using "git commit -n".

12. "less" pipe do not work, so you have to specify a pager manually.
Such as "git log | less".

13. "vi" will be the plain vi in msys, it is not compatible with
cygwin, so just remove it. Only affect "git commit -c".

14. "gitk" should have a similar alias.


对 less, vi, gitk 的处理还是很糟糕。trailing blanks 据说可以有 pre-commit hook 处理?


15. 对于 vi,可以考虑使用 bash 行编辑 "^X^E" 命令,调用外部编辑器。这样可以实现多行注释。然而,真正的问题在于 "git commit -c"

16. clone 和 push 操作,必须用 git.exe 完成,因为路径的关系。如果可以在 msysgit shell 中执行 mount,修改挂载点,可能解决 15 和这个问题,然而 msysgit 没有 mount 命令。

17. trap 命令对 msysgit shell 无效... 如果在 cygwin 中执行 msysgit shell,总是能用 ^C 退出。so annoying.
Tags: fedora

  • 备份

    Google Groups will no longer be supporting the Welcome Message feature. Starting January 13, you won't be able to edit your welcome messages, but…

  • 在豆瓣申请主办方(FAIL!)

    http://www.douban.com/location/shenzhen/new_host 深圳 Linux Unix 用户组 szlug 南山实验学校鼎太部 SZLUG…

  • 2020

    Last time I wrote a review was in 2018, about 2017. Or maybe I wrote something elsewhere, maybe on Twitter? It was hard to write something freely…

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded