At the moment (beginning of April 2015) the “official” version of Git for Windows is
1.9.5 , while for all other platforms version 2.3.5 is already available. Hence the natural interest in updating Git for Windows to the current version or replacing it with an alternative distribution.
After a little research, the following methods (distributions) of using Git on the Windows platform were discovered.
Git for windows
The distribution kit offered on the official
git-scm site is based on the MSYS project. That is, in fact, it is ported to Windows Git plus some subset of GNU utilities needed for Git to work.
')
Among the shortcomings are the outdated version of Git and other GNU utilities. In the bugtracker for several years, there are requests for updating utilities (
perl ,
ssh , ...).
There are no utilities I need (rsync, ...). They have to be borrowed from the MSYS project, which does not always work (different versions, sometimes incompatible with each other).
At the moment the project is
moving to another base - MinGW-w64 + MSYS2. The developers have posted the
Developer's Preview version , but at the time of the check it did not have the ssh utility, and the problem with adding other utilities seems to remain. But the GNU utilities have been updated to current, especially perl.
A selection of tools from the project MinGW-builds
This
assembly was discovered almost by accident, in the process of finding a more recent version of GCC. Contains all the utilities I need. But, unfortunately, has not been updated for a long time.
MSYS2
I learned that there is an independent project
MSYS2 from the messages on the git-for-windows project tracker. Of the benefits:
- MSYS-independent project
- uses minGW-w64,
- uses Pacman package ported with Arch Linux (more stable and functional, unlike mingw-get),
- fresh versions of utilities,
- git is present in packages
- There is a 64-bit version.
Of the minuses, probably a larger size when installing by default, compared to Git for Windows. But excess packages can be removed.
EGit / JGit
Implementing Git from Eclipse (in Java). It is possible to call from the command line, but the MSYS shell is required, and this is a proof-of-concept rather than the normal way of working.
SmartGit / Hg
This is also a proprietary
Git implementation in Java. There is no normal way to work on the command line. And so, a great tool, there is an Open Source License.
libgit2
Very promising project. It is made initially portable, implementation on pure C. But for now there are no projects that have implemented all the functionality of Git (GUI + command line) using only this library.
Projects:
- Git-GUI - alpha version, no command line.
- Github for windows - uses Git for Windows for the command line.
Here you can also mention the
posh-git project, but, as I understand it, it also requires that Git is already available from the command line.
Cygwin
Unlike MSYS , it implements (or tries) a complete POSIX layer for applications. I'm more impressed with the MSYS approach. When used, it seemed to me more heavy compared to MSYS.
Total
Stopped at MSYS2. I liked the fact that Git is made in the form of a package (with dependencies, etc.), as well as the presence of fresh GNU utilities that are easy to install from packages.
The following will be described: the comments that appeared during the operation, possible difficulties and ways to solve them.
Installation
1. Download
32-bit or
64-bit MSYS2. Yes, now there is 64-bit Git, notes about it below.
There should be no spaces in the name of the installation folder (and the path), and there should be only ASCII characters (ASCII, no accents, spaces nor symlinks, short path). In the future, I will refer to this folder as% MSYS2_DIR%.
After the installation is complete, start the MSYS2 Shell (Start → All Programs → MSYS2).
2. Install and update MSYS2 packages (described in more detail
here , or
here with pictures ):
pacman -Sy pacman --needed -S bash pacman pacman-mirrors msys2-runtime
Restart the MSYS2 Shell and run
% MSYS2_DIR% \ autorebase.bat for the 32-bit version. Further
pacman -Su
3. Configure HOME
By default, the HOME folder is created in
% MSYS2_DIR% \ home \% USERNAME% , and the
% MSYS2_DIR% \ etc \ skel files are copied into it, as described in
% MSYS2_DIR% \ etc \ post-install \ 05-home-dir.post . It is possible to customize the folder
HOME =% USERPROFILE% . To do this, move all files from% MSYS2_DIR% \ home \% USERNAME% to
% USERPROFILE% and correct the line
"db_home: cygwin desc" in the
% MSYS2_DIR% \ etc \ nsswitch.conf file to
"db_home: windows desc"
perl -pi.orig -e "s/db_home:\s+cygwin\s+desc/db_home: windows desc/" nsswitch.conf
If the HOME variable is already there, then files from
% MSYS2_DIR% \ etc \ skel will not be copied anywhere. If necessary, copy them manually, and / or update .bashrc and other files.
4. Install Git
pacman -S git
Customization
1. To add autocompletion (on Tab) of Git commands and additional information in the command prompt, copy the files:
%MSYS2_DIR%\usr\share\git\completion\git-completion.bash -> %HOME%\.git-completion.bash %MSYS2_DIR%\usr\share\git\completion\git-prompt.sh -> %HOME%\.git-prompt.sh
Add lines to the
% HOME% \. Bashrc file
. ~/.git-completion.bash . ~/.git-prompt.sh PS1='\[\033]0;$MSYSTEM:${PWD//[^[:ascii:]]/?}\007\]'
The git-prompt setting (variable
PS1 ) is taken from previous versions of Git for Windows.
Note
PS1 = "$ PS1" $ '\ n' . The expression
$ '\ n' is used to fix the
bugIf it is a newline, it’s a funky way to get it.
2. Documentation
Manpages will be installed with the git package. You will need the man-db package to view:
pacman -S man-db
And further, as usual
man git-add
Html documentation is not yet available
git help add fatal: '/usr/share/doc/git/html': not a documentation directory.
Accordingly, you can try to
build it yourself, or extract it from the
PortableGit archive and copy it to
% MSYS2_DIR% / usr / share / doc / git / html .
Git 32bit vs. 64bit
During 64bit Git operation, there was an increased memory consumption for some commands. For example, git-fast-import when converting a large repository (about 5GiB) easily eaten up all available RAM (when the paging file is disabled, this manifests itself as a system message stating that the application does not have enough memory and is offered to close the program). For the same (already converted) repository, TortoiseGit Log could not display the commit tree, and the running git subprocess again ate up all the RAM.
For 32bit Git, this was not observed, and all commands, including those in conjunction with various GUI and IDE, worked perfectly.
I decided to use Git 32bit for now.