23

Everywhere I read about Mercurial and Git they generally throw in a line or two which implies Git has limited ability on Windows (because of some Shell scrips cannot be ported, etc.) but I've never come across some page which explicitly mentions them. And most pages are a tad old.

What are the limitations of Git on Windows in terms of functionality? And does having to run Git on MinGW and MSYS on Windows have performance limitations?

Jungle Hunter
  • 6,877
  • 8
  • 39
  • 66
  • I don't think so. I've been using GIT on Windows via CygWin for over a year now without a hitch. I'm not certain enough of the possible issues to make this an answer, though. – rossipedia Jul 22 '10 at 21:17
  • A year is pretty much enough time to notice something. Maybe they've ported Shell scripts to something faster like C now. – Jungle Hunter Jul 22 '10 at 21:35
  • The basic limitations are the same limitations as Windows has, e.g. case insensitive file names or slow filesystem. – takeshin Jul 22 '10 at 21:47
  • Back when git was first introduced, Cygwin was the only way to get it to work on Windows, which for most Windows users, was akin to not working at all. The Windows support is far better now and pretty much a non-issue now. – wadesworld Jul 23 '10 at 04:39

3 Answers3

27

EDIT: So it's 2016, six years on from when I wrote the original answer below. I've used git and mercurial heavily for several years now, and I've been developing on a mac for several years too. I've become very familiar and comfortable with git usage on the command line, but for day-to-day work I use SourceTree from Atlassian. This is not an advertisement, just a note to update this answer. SourceTree is a double abstraction: the same ui for for git/hg, and the same ui for Windows/Mac. When you have to switch platforms and projects often, this becomes very attractive.

Having written a guide to setting up both client and server for Git on Windows, I have a pretty good idea of what one can expect. Also, my primary repository (.git folder) is ~260MB of source, so it is really not a trivial performance test for day-to-day Git work on Windows.

My general impression is that Git on windows is very fast for the vast majority of situations one is likely to encounter, with one really huge exception: git gui blame -C -C. By default, git will not blame on files beyond file rename boundaries, and the extra -C -C arguments must be passed to enable that to happen, but then things can really slow down. It takes 17 minutes on modern hardware to produce a complete annotation of one of our larger ~20 kloc source files. That delay can really break your concentration.

Regarding cygwin:

I only tried this once, and not for anything significant. I really wanted a native solution. By all accounts, git on cygwin works well enough.

Regarding TortoiseGit

Frank Li has done tremendous work bringing the now-familiar UI to the Git world. TortoiseGit started up very quicky because most of the UI was available from TortoiseSVN (and other tools like TortoiseMerge), and I have worked with this interface a great deal. In general, it allows one to get going with Git very quickly if you are familiar with TortoiseSVN. The developer has gone to great pains to use terms from the TortoiseSVN world and map them to git commands. For instance, a revert really performs a git checkout <file> under the hood.

In general, working with Git this way has been pretty seamless, and I must admit to having learned Git while using the TortoiseGit interface: and it must be conceded that this was a hindrance to my education. The TortoiseSVN-like log viewer doesn't really work for a distributed-vcs workflow (it works well enough it you use Git as if it were SVN), and you only find this out later because the problems only come in when there are many, many development branches (the gitk tool is much better at handling this display). And the other issue is that even after using TortoiseGit for many months, I still didn't know even the most basic git commands. There is nothing really wrong with TortoiseGit, and bugs get fixed impressively quickly when they do occur; the main problem seems to be a design issue (possibly more than one) in the UI, something that the gitk and git gui developers have worked out because of a longer development history, or a more intimate knowledge of idiomatic git usage, or something like that.

Regarding command-line use:

The MSYS git development team are the ones who really should be thanked for even bothering to do all the work they did, and without their support it is likely the mingw git branch would never even have been merged with mainline.

I have now begun using msysgit, as is, in the Git Bash shell, as my only git interface for a few weeks. My impression is that, although the initial learning seems more difficult, once that knowledge has been gained, everything else becomes easier. This reference is, in my opinion, one of the really better references learning git on the command line.

Speaking as a Git user on Windows, and coming from an extended experience using the TortoiseGit interface to git, this is a summary of my workflow, which covers >95% of what is needed (all in Git Bash, not the Windows command shell (cmd)):

  • Check for Modifications

    git status

  • Switch branch

    git checkout some-feature-branch

  • Fetch

    git fetch

  • Show Log (the & detaches the gitk process from the shell, so that the shell doesn't wait for gitk to be closed before allowing more commands)

    gitk &

  • Commit: either

    • Simple commit:

      git commit -a -m "This is my commit message"

    • Complex, multiple successive commits:

      git gui

  • Push to branch: master

    git push origin master

  • Merge (e.g. after Fetch)

    git merge origin/master

I haven't had to do any conflict-resolution yet, but I'll figure that out when the time comes (comments welcome :).

EDIT: For conflict resolution, kdiff3 is the way to go. Setup is simple, and everything from simple diffs up to three-way merge works reliably and swiftly.

Conclusions

  • Git on Windows is full-featured, and works as advertised, and is not limited on Windows.

  • Performance is generally very good, but comprehensive large blames might be slow.

  • The TortoiseGit interface is seductive, but ultimately unsatisfying: you should try to learn git on the command-line. I have done both, and this route is more efficient.

Caleb Hattingh
  • 8,388
  • 2
  • 27
  • 42
  • 4
    Git extensions seems to work so much better than TortoiseGit. It may not be the same familiar UI but it seems to be very powerful on Windows. – KallDrexx Jul 23 '10 at 15:02
  • Yes GitExtensions has a nice features set as a Visual Studio add-in – MatthieuGD Oct 05 '10 at 22:46
  • It should be added that [Git doesn't support symlinks on Windows](http://stackoverflow.com/q/11662868/237285). – Andres Riofrio Jul 26 '12 at 21:44
  • I have to strongly disagree with the claims about performance: On our similarly sized codebase, any operation on Windows is considerably (factor 2-5) slower than under Linux, on exactly the same hardware. – Janick Bernet May 15 '13 at 09:48
  • @inflagranti: it is true that git flies on linux. However, we cannot all choose our dev platform. The performance on windows is not so bad that git cannot be useful there. – Caleb Hattingh May 16 '13 at 23:44
  • Agreed, performance is nowhere near that it would make git unusable, but in direct comparison it's pretty sad how much slower git operates under Windows. – Janick Bernet May 17 '13 at 11:20
9
  • dubious wildcard support:
    (problematic for .gitignore files)
    send to the underlying OS-specific fnname() method: see this question and that one (or that one)

  • git-svn might not be very fast.
    Source: this SO answer. It has made some good progress though.

  • the PATH need to be adjusted to prevent any conflict
    Some commands are the same between Windows and the bash. (find, cp, rm, ...).
    See this SO answer.
    As cjrh comments, Git for Windows doesn't add its bin directory by default to the PATH.

  • some EOL conversion can take place (Unix vs. Windows EOL)
    See Definitive recommendation for git autocrlf settings.
    The new and improved core.eol and eol attributes from Git1.7.2 are not there yet in msysgit.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • That makes me wonder if I should move to HG while on Windows. – Jungle Hunter Jul 22 '10 at 22:02
  • 1
    msysgit no longer adds the `bin` folder to the system path by default. Hasn't for several releases. git-svn is really, really slow, but I don't have a sense of performance relative to other platforms. It is uncomfortably slow from the pov of human perception. EOL conversion caused problems for us in a much earlier version, and we have it disabled since then. – Caleb Hattingh Jul 22 '10 at 22:18
  • The first point isn't really Windows-specific. `.gitignore` simply uses the underlying system's `fnmatch()` function. AFAIK, MinGW's `fnmatch()` is fully POSIX-compliant and everything you do outside of POSIX can break in just the same way on every other Operating System, not just Windows. – Jörg W Mittag Jul 23 '10 at 13:23
  • @Jörg: "AFAIK, MinGW's fnmatch() is fully POSIX-compliant": I hope so, but I have observed different results between `.gitignore` on Unix and Windows... – VonC Jul 23 '10 at 16:00
3

(This is probably more of a comment than an answer, but my rep's not quite there yet.)

I wondered the same thing recently, and I wasn't able to dig up too much either. Here's one interesting discussion (discovered via a citation on Git's wikipedia entry).

As far as I can tell, the main issues are performance (particularly on Cygwin, and/or with large repositories) and file system issues (file name case-insensitivity, limited VFS).

Purely subjective/anecdotal:

I feel like Git is a much more pleasant experience running natively under Ubuntu 10.04 than on Cygwin under Win7 on the same machine--so much so that I've been shifting almost all of my freelance web development work to Ubuntu to take advantage of it (among other things). I learned Git on my OSX machine at work, so trying to work with it on Windows afterwards was almost painful. msysgit is definitely an improvement over Cygwin, but it still suffers from the limitations of the Windows file system.

EDIT: Apparently, msysgit chokes on filenames that were entered into git via a UTF8-aware filesystem, like Linux, which sucks.

I also just stumbled across GitSharp, a WIP native Windows implementation (discovered via this blog comment).

peterjmag
  • 5,573
  • 1
  • 26
  • 26
  • 2
    It is not exactly true that msysgit chokes on unicode. It would be more accurate to say that msysgit chokes on filenames that were entered into git via a UTF8-aware filesystem, like Linux. Unicode filenames created on Windows (UTF16) are fine. – Caleb Hattingh Jul 22 '10 at 22:26
  • Ah, thanks, I obviously didn't read my own link. I've edited my answer to clarify. – peterjmag Jul 23 '10 at 00:03
  • 1
    I think for the bug to feature, the filenames also have to have unicode characters in them. So filenames created on Linux that have direct mappings to ASCII characters will also be fine. The problems occur with filenames that have characters in them that do not map to ASCII characters, which is everything after the first 255, or something like that. – Caleb Hattingh Jul 23 '10 at 06:32
  • 1
    @cjrh, that doesn't appear to be true. I have some files on my Windows Server 2003 box with Unicode names, and when I try to add them to Git, it chokes. "fatal: unable to stat 'Documents/????? ?p?de?p??.mht': No such file or directory" This is with the latest version of msysgit, 1.7.6. – Ryan Lundy Aug 10 '11 at 01:01
  • @Kyralessa: it could be that something has changed in the newer version of msysgit. Unicode (and text encodings in general) are a minefield. – Caleb Hattingh Nov 29 '11 at 01:55