-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Technical overview
Git for Windows is essentially a subset of MSYS2 with a defined set of installed packages of which a subset is included in the installer.
The process to build an instance of the Git for Windows installer is made easier with the Git for Windows SDK
. Basically, the steps are as follows:
- Download and install the SDK, which installs the sources for
git
, additional msys and mingw packages, and helpers to build the installer. It also provides theGit for Windows SDK
MSys shell - [optional] Hack in the changes you want and make these changes available to the installer.
- Call the right helper tools to build the package you want.
Download the SDK and run it (using "Run as Administrator"). You will end up with a console window running the Git for Windows SDK
shell, which you can use for the next steps. You need to fetch the latest version of the Git sources - just run the command sdk init git
. After that, if you just want to build an installer from the latest development, you are ready to go.
You can open the Git for Windows SDK
shell by double clicking git-bash.exe
in the install folder.
As the installer is made by putting together files from the Git for Windows SDK, it is advisable to update those files first. To update the packages, call pacman -Syu
(caveats apply).
If you only want an installer of the latest development version of git, then you can skip this step.
The sources of git are checked out in /usr/src/git
. Hack in (and test) the changes you want...
Afterwards you need to install git to make these changes available to the installer build: cd /usr/src/git && make install
.
If you made any documentation changes, you need to install the documentation too: make install-html && prefix=/mingw64 make -C contrib/subtree install-html
(the second make invocation installs the git-subtree.html
which is otherwise missing and leads to an error by the portable installer).
In some cases, the change you want to make is not in git itself, but in the additional files needed to emulate the *ix environment git expects (things like grep
, find
, cat
,...), or in additional helper files (e.g. start-ssh-agent.cmd
). These files come from Msys and Mingw packages. Please see the documentation for how to make changes to these packages. Some files are also in the build-extras
repo in the subdir mingw-w64-git-extra
(the script which calls notepad as a commit message editor, diff filter for word files,...). The source code for these files are also under /usr/src
but need to be checked out first (e.g. cd /usr/src/MINGW-packages && git fetch && git checkout main
).
You can build both a normal setup installer and a portable one.
The installers are basically created by collecting files from the Git for Windows SDK
Msys environment, not from any checked out source code! It's therefore important to make any changed files available to the installer (the make
calls in the "Hacking on git" step)!
As a one time step, you need to prepare the extra files which contain the helper scripts:
cd /usr/src/build-extra
git fetch
git checkout main
The next step depends on whether you want a normal setup-based installer or a portable installer:
To build a setup based one:
./installer/release.sh <version>-test
where <version>
is the Git version.
To build a portable installer, use:
./portable/release.sh <version>-test
The last line of the log shows where the installer packages were created (usually in your user directory: c:\Users\<login-name>
).
See also:
- Debugging git with gdb
- Running Git's regression tests
- MSYS/MINGW package management
- Updating the SDK
- MSYS2
This is the Git for Windows wiki. See how-to-participate.