Git Bash Usermanual
Git Bash Usermanual
Table of Content
1. Introduction.................................................................................................................3
2. Purpose.......................................................................................................................4
4.1 Steps...................................................................................................................8
5. Conclusion......................................................................................................................... 11
6. FAQS................................................................................................................................... 12
2
1. Introduction
1.1 What is Database?
3
2. Purpose
The purpose of Git bash is the command prompt which you would use to interact between github
and your local copy of the code. You can clone a repository from github to your local machine,
make changes, commit them, push them back to github for everyone else to consume. For all
these activities, you need git bash. Git bash is an interface to github but is not limited to github
only. You can use it with any other git hosting as well such as gitlab, bitbucket etc.
git bash is the utility to interact with github..
On Windows you might run commands like ipconfig /all or format G: using cmd.exe. These
commands are actual executable files under C:\Windows\system32, stored as ipconfig.exe and
format.com files. cmd.exe is separate from both and loads and runs them on user's request.
ssh, scp, cat, find are run using bash in exactly the same way. They are usually stored under
/usr/bin rather than in C:\Windows\system32 on *nix systems, because Windows and *nix have
their system file structure organised differently.
In the case of Git Bash for Windows these programs are located in the Git installation folder: C:\
Program Files\Git\usr\bin, which can also be found in the emulated Linux environment under
/usr/bin.
Just like being able to just run cmd.exe on *nix doesn't allow you to do much without the other
system utilities, just being able to run Bash on Windows is not very useful either. This means
that all these extra commands have to be bundled together with Bash to create a usable software
package.
2.1 GitHub is a code hosting platform for version control and collaboration. It lets you and
others work together on projects from anywhere. This tutorial teaches you GitHub essentials like
repositories, branches, commits, and Pull Requests.
4
3. Installation of Git Bash
3.1 Steps
1. First of all go to the website https://gitforwindows.org/
2. Click on download .Once its downloaded click the executable .exe file
5
3. Choose the valid path where you want to install the Git Bash
5. You will see the terminal like this once your git bash is installed
6
6. You can use a command on terminal git –version which will let you know the
gitbash version
7
4. Configuration & Running Commands on Git Bash
4.1 Steps:
Once you start running the Git bash you need commands to run
git init : Create empty Git repo in specified directory. Run with no arguments to initialize
the current directory as a git repository
git clone <repo> :Clone repo located at onto local machine. Original repo can be
located on the local machine or on a remote machine via HTTP or SSH
git config user.name :GIT BRANCHES Define author name to be used for all commits in
current repo. Devs commonly use --global flag to set config options for current user.
git config user.email :GIT BRANCHES Define author email address to be used for all
commits in current repo. Devs commonly use --global flag to set config options for
current user.
8
git add: Stage all changes in for the next commit. Replace with a to change a
specific file.
git commit -m "" :Commit the staged snapshot, but instead of launching a text editor,
use as the commit message.
git status: List which files are staged, unstaged, and untracked.
git commit --amend :Replace the last commit with the staged changes and last
commit combined. Use with nothing staged to edit the last commit’s message.
git rm[file] :This command deletes the file from your working directory and stages the
deletion.
9
git branch :This command lists all the local branches in the current repository.
git remote add [variable name] [Remote Server Link] : This command is used to
connect your local repository to the remote server.
git push [variable name] master : This command sends the committed changes of
master branch to your remote repository.
git pull [Repository Link] : This command fetches and merges changes on the remote
server to your working directory
10
5. Conclusion
To conclude it can be said that git bash is a command line platform which helps in enabling git
and its elements in your system. There are a bunch of commands which are used in git bash.
With these commands (git init, git add, git commit), you can start tracking your code
development Adding a few additional commands (git push, git clone, git pull) and a GitHub
account, you can share your code online, transfer your changes across machines, and collaborate
in small groups
Git Bash is very easy to use and makes it easy to work on repositories and projects
11
6. FAQS
Question 1: What is a commit message?
The command that is used to write a commit message is “git commit -a”.
Now explain about -a flag by saying -a on the command line instructs git to commit the new
content of all tracked files that have been modified. Also, mention you can use “git add <file>”
before git commit -a if new files need to be committed for the first time.
12