...

Что за программа git bash

What is the exact meaning of Git Bash?

I have been working with Git Bash for the last two days. I know now the basic operations such as commit , push , pull , fetch , and merge . But I still don’t know what Git Bash itself actually is! I’ve searched a lot about Git Bash, but all sites which I have seen focus on the functionality of its commands. I still haven’t found a good answer for my question. Now, I think, I’m in the right place to get this answer!

asked Jul 23, 2013 at 10:23
1,829 8 8 gold badges 26 26 silver badges 45 45 bronze badges
People may also be interested in my question on SuperUser What is Git Bash for Windows anyway?
Sep 12, 2018 at 18:21

There’s no such thing as «Git bash». There is «bash» and there is «git». Bash is an interactive command line interpreter, sometimes also called just «sh» or «shell» for historical reasons, analoguous to Microsoft’s «cmd». There is, however, «git shell», which is a «locked-down» command interpreter used to limit the power of anonymous access to git servers, and is part of the git distribution. Since git was developed on and for UNIX like systems, it is best paired with «bash» CLI, although, in theory, it is shell-agnostic.

Sep 29, 2019 at 16:58

4 Answers 4

git bash is a shell where:

  • the running process is sh.exe (packaged with msysgit, as share/WinGit/Git Bash.vbs )
  • git is a known command
  • $HOME is defined

On a Windows 64:

C:\Windows\SysWOW64\cmd.exe /c ""C:\Prog\Git\1.7.1\bin\sh.exe" --login -i" 

This differs from git-cmd.bat , which provides git commands in a plain DOS command prompt.

A tool like GitHub for Windows (G4W) provides different shell for git (including a PowerShell one)

Update April 2015:

Note: the git bash in msysgit/Git for windows 1.9.5 is an old one:

GNU bash, version 3.1.20(4)-release (i686-pc-msys) Copyright (C) 2005 Free Software Foundation, Inc. 

But with the phasing out of msysgit (Q4 2015) and the new Git For Windows (Q2 2015), you now have Git for Windows 2.3.5.
It has a much more recent bash, based on the 64bits msys2 project, an independent rewrite of MSYS, based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 with the aim of better interoperability with native Windows software. msys2 comes with its own installer too.

The git bash is now (with the new Git For Windows):

GNU bash, version 4.3.33(3)-release (x86_64-pc-msys) Copyright (C) 2013 Free Software Foundation, Inc. 

Original answer (June 2013) More precisely, from msygit wiki:

Historically, Git on Windows was only officially supported using Cygwin.
To help make a native Windows version, this project was started, based on the mingw fork.

To make the milky ‘soup’ of project names more clear, we say like this:

  • msysGit — is the name of this project, a build environment for Git for Windows, which releases the official binaries
  • MinGW — is a minimalist development environment for native Microsoft Windows applications.
    It is really a very thin compile-time layer over the Microsoft Runtime; MinGW programs are therefore real Windows programs, with no concept of Unix-style paths or POSIX niceties such as a fork() call
  • MSYS — is a Bourne Shell command line interpreter system, is used by MinGW (and others), was forked in the past from Cygwin
  • Cygwin — a Linux-like environment, which was used in the past to build Git for Windows, nowadays has no relation to msysGit

So, your two lines description about «git bash» are:

» Git bash » is a msys shell included in «Git for Windows», and is a slimmed-down version of Cygwin (an old version at that), whose only purpose is to provide enough of a POSIX layer to run bash.

msysGit is the development environment to compile Git for Windows. It is complete, in the sense that you just need to install msysGit, and then you can build Git. Without installing any 3rd-party software.

msysGit is not Git for Windows; that is an installer that installs Git — and only Git.

47 5 5 bronze badges
answered Jul 23, 2013 at 12:34
1.3m 530 530 gold badges 4425 4425 silver badges 5266 5266 bronze badges
i want to know just meaning about that!
Jul 24, 2013 at 5:10
@DRAJI do you mean my answer didn’t cover what you wanted to know?
Jul 24, 2013 at 5:26
@DRAJI is there any more detail you would want to know about » git bash «?
Jul 24, 2013 at 5:41

Of course. But First of all i want to know just two line description about that.After that i will take a next step.

Jul 24, 2013 at 5:45
for instance, what is the difference between UNIX Bash and Git Bash?
Sep 5, 2014 at 7:45

I think the question asker is (was) thinking that git bash is a command like git init or git checkout. Git bash is not a command, it is an interface. I will also assume the asker is not a linux user because bash is very popular the unix/linux world. The name «bash» is an acronym for «Bourne Again SHell». Bash is a text-only command interface that has features which allow automated scripts to be run. A good analogy would be to compare bash to the new PowerShell interface in Windows7/8. A poor analogy (but one likely to be more readily understood by more people) is the combination of the command prompt and .BAT (batch) command files from the days of DOS and early versions of Windows.

  • https://en.wikipedia.org/wiki/Bash_(Unix_shell)
  • https://en.wikipedia.org/wiki/Windows_PowerShell

answered Oct 10, 2015 at 7:47
345 2 2 silver badges 14 14 bronze badges

One thing I don’t understand is if Git bash is a shell like cmd or PowerShell. Why does it need to run within MinTTY or cmd(two options can be chosen from install steps). Shouldn’t it have it’s own interface?

May 18, 2022 at 23:22

Bash is a Command Line Interface that was created over twenty-seven years ago by Brian Fox as a free software replacement for the Bourne Shell. A shell is a specific kind of Command Line Interface. Bash is «open source» which means that anyone can read the code and suggest changes. Since its beginning, it has been supported by a large community of engineers who have worked to make it an incredible tool. Bash is the default shell for Linux and Mac. For these reasons, Bash is the most used and widely distributed shell.

Windows has a different Command Line Interface, called Command Prompt. While this has many of the same features as Bash, Bash is much more popular. Because of the strength of the open source community and the tools they provide, mastering Bash is a better investment than mastering Command Prompt.

To use Bash on a Windows computer, we need to download and install a program called Git Bash. Git Bash (Is the Bash for windows) allows us to easily access Bash as well as another tool called Git, inside the Windows environment.

Git Bash

По сути Git — это набор служебных программ командной строки, предназначенных для выполнения в Unix-подобных средах. Современные операционные системы, такие как Linux и macOS, имеют встроенные терминалы командной строки. Благодаря этому они особенно удобны для работы с Git. В Microsoft Windows используется командная строка Windows, отличная от терминала Unix-систем.

В средах Windows система Git часто упаковывается в виде части высокоуровневого приложения с графическим интерфейсом. Графические интерфейсы для Git могут абстрагировать и скрывать базовые компоненты системы контроля версий, которая лежит в основе. Это отличное подспорье для новичков в Git, чтобы они могли быстро внести свой вклад в проект. Но когда требования повышаются и предполагается работа с остальными членами команды, необходимо понимать принципы работы исходных методов Git. Тогда может быть выгодно отказаться от версии с графическим интерфейсом в пользу инструментов командной строки. Интерфейс терминала Git предлагается в приложении Git Bash.

Что такое Git Bash?

Git Bash — это приложение для сред Microsoft Windows, эмулирующее работу командной строки Git. Bash — аббревиатура от Bourne Again Shell. Оболочка (Shell) представляет собой приложение терминала для взаимодействия с операционной системой с помощью письменных команд. Bash — популярная оболочка, используемая по умолчанию в Linux и macOS. Git Bash представляет собой пакет, который устанавливает в операционную систему Windows оболочку Bash, некоторые распространенные утилиты Bash и систему Git.

Установка Git Bash

Git Bash поставляется в составе пакета Git For Windows. Скачайте и установите Git For Windows, как любое другое приложение для Windows. После загрузки найдите входящий в состав пакета файл .exe и откройте его, чтобы запустить Git Bash.

Использование Git Bash

Git Bash поддерживает те же операции, что и стандартная оболочка Bash. Полезно изучить основные примеры использования Bash. Поскольку этот документ посвящен системе Git, расширенные примеры использования Bash здесь не рассматриваются.

Навигация по папкам

Bash-команда pwd используется для вывода пути к текущему рабочему каталогу. Команда pwd эквивалентна выполнению команды cd в терминале DOS (или в консоли Windows). Это папка или путь для текущего сеанса Bash.

Bash-команда ls используется для вывода списка содержимого текущего рабочего каталога. Команда ls эквивалентна команде DIR в консоли Windows.

И оболочка Bash, и консоль Windows поддерживают команду cd . Команда cd представляет собой акроним от «Change Directory» (сменить каталог). Команда cd вызывается с добавлением в качестве аргумента имени каталога. При выполнении команды cd происходит смена текущего рабочего каталога сеанса терминала на каталог, переданный в виде аргумента.

Команды Git Bash

Готовы изучить Git?

Ознакомьтесь с этим интерактивным обучающим руководством.

При подготовке материала использовались источники:
https://stackoverflow.com/questions/17807485/what-is-the-exact-meaning-of-git-bash
https://www.atlassian.com/ru/git/tutorials/git-bash

Оцените статью