One-Page Tutorial for Git

One-Page Tutorial for Git

Git version control system

In this page, I’ll try to make the process of Git version control system learning as simple as possible: Its one-chapter tutorial!

Though we can use GUI version, git is completely a command line utility. So, I’ll be working mostly on command line mode. As we learn git, we’ll realize the command line is really a first class option, and it’s the core of a git.

One-Page Tutorial

After finishing this one-page tutorial, we’ll learn:

Git Version
• Git Init, Creating a git repository, Clone, Branch/Branching
• Add, Commit, SSL Verify, Git Diff, Pull request
• Push Request, Config List, General questions and etc.,

In this express tutorial, I’ll work on Windows as a local repository.

Git Version

To see Git Version, Use the below command

$ git –version

git version 1.9.1

Git Init

Creating a git repository in local system

git init spring-boot-data-mongodb-example

Initialized empty Git repository in E:/ spring-boot-data-mongodb-example/.git/

Git Clone

The git clone brought all the information include all branches. All have been pulled to our local machine.

To clone the project into local system

git clone


To see list of branches which are available in remote repository

$ git branch -a
* master
remotes/origin/HEAD -> origin/master


Git branch is most important to manage developer source code maintenance.

To create new branch in local system

$ git branch dev

Then, we need to switch to the new branch:

$ git checkout dev
Switched to branch ‘dev’

Note that at this point there is no difference between the master and the new branch, dev.

Then, we make a new file called “dev_new.txt”.

$ git status
On branch dev
Untracked files:
(use “git add …” to include in what will be committed)

To add a file into local git object

$ git add dev_new.txt

To commit into local git object

$ git commit -m “new file to dev branch”
[dev 49c85fd] new file to the new branch
1 file changed, 1 insertion(+)
create mode 100664 dev_new.txt

Note that we’re working on local repository.

Pushing back to github or remote repository.

$ git push -u origin dev

Branch dev set up to track remote branch dev from origin.

In the command the -u option stands for upstream. It would refer to the main repo that other people will be pulling from. The -u option automatically sets that upstream for us, linking our repo to a central one. That way, in the future, Git knows where we want to push to and where we want to pull from, so we can use git pull or git push without arguments.

One more thing while we are on local – file system is updated when we switching to another branch. In other words, when we switch to the master branch, the update file system does not have dev_new.txt file:

Switch Branch

To switch to master branch

$ git checkout master

Switched to branch ‘master’

Your branch is up-to-date with ‘origin/master’.

Pull request

The pull request is a way of updating latest code changes into local repo.

$ git pull origin dev

Configure User Name and Email


To configure the git user name and email into local git repository within the project. This is used to identify the user.

$ git config “Abiramasundari B”
$ git config


To configure the git user name and email into Global. This is used to identify the user.

$ git config –global “Abiramasundari B”
$ git config –global

SSL Verify

To ignore SSL, verify, follow the below command

$ git config http.sslVerify false

$ git config –global http.sslVerify false

GIT Diff

The git diff is merely telling to local git what are all the files are modified.

To see the changes in the modified file before adding to git

git diff

To see the changes in the modified file after adding to git

git diff –cached

Adding a file to a git

The git add is merely telling to local git which is our intention of adding files for the next transaction. It’s not adding the file to a repo yet. It just signals our participation.

$ git add first.txt

Git Status

Get the status for your local git repository.

$ git status

On branch master
Initial commit
nothing to commit (create/copy files and use “git add” to track)

Now we can commit to the master branch

$ git commit -m “My first commit”

Remote URL

Remote URL is a project repository. Here’s Setting the origin URL into local repository

//Adding remote’s URL
git remote add origin

//Change your remote’s URL from SSH to HTTPS with the git remote set-url command.
git remote set-url origin

Push to Remote Repository

git push -u origin master

The first.txt has been pushed into the Github!


To avoid files while adding and committing into git


Configuration List

To see the local git configuration list, use the below command

$ git config –list

Git General Questions

How to remove a file from Git?

To remove a file from Git, you have to remove it from your tracked files (more accurately, remove it from your staging area) and then commit.

The git rm command does that, and also removes the file from your working directory so you don’t see it as an untracked file the next time around.

What is Tracked Files in Git?

Tracked files are called as staging files in git which are already added into git and recently modified This files are yet to commit.

What is Untracked Files in Git?

Untracked files are called as non-staging files in git which are newly created files but not yet committed. It’s up to you which you want to commit or not.
Look forward your post or comments or questions regarding git.

1 Comment on this Post


    Touche. Great arguments. Keep up the good spirit.

  1. By My Homepage on June 13, 2017 at 8:53 PM

    … [Trackback]

    […] Informations on that Topic: […]

  2. By best money making on June 19, 2017 at 8:20 AM

    … [Trackback]

    […] Informations on that Topic: […]

  3. By Kata Kata Ucapan Lebaran Idul Fitri 2017/2018 on June 22, 2017 at 8:34 AM

    … [Trackback]

    […] There you will find 29208 more Infos: […]

Leave a Comment