Extra bit with git

19
Extra Bit With GIT

Transcript of Extra bit with git

Extra Bit With GIT

WHAT WILL BE OUR GOAL FOR THIS WORKSHOP...

➢ We will help you to learn the basic functionality of Git version control system.

➢ After completing this workshop, you will find yourself at a moderate level of expertise in using Git version control system from where you can take yourself to the next levels.

TOPICS WHICH WE WILL COVER...

➣ How to create a repository➣ How to clone a repository➣ How to push code in a repository➣ How to pull code from a repository

SOME KEY TERMS….

❖ Open Source

➢ denoting software for which the original source code is made freely available and may be redistributed and modified.

WHAT IS GIT?

➢ Git is a distributed revision control and source code management system with an emphasis on speed.

➢ Git was initially designed and developed by Linus Torvalds for Linux kernel development.

➢ Git is a free software distributed under the terms of the GNU General Public License version 2.

ADVANTAGES OF GIT

➢ Free and open source➢ Fast and Small➢ Implicit Backup➢ Security➢ No need of powerful hardware➢ Easier branching

BASIC TERMINOLOGIES…..

➢ Repository

It is a private workplace as a working copy. Developers make changes in their private workplace and after commit, these changes become a part of the repository.

➢ Working Directory

The working directory is the place where all the files of your repository are located.

WORKFLOW OF GIT

Step 1 : You modify a file from the working directory.

Step 2 : You add these files to the staging area.

Step 3 : You perform commit operation that moves the files from the staging area. After push operation, it stores the changes permanently to the Git repository.

FLOW CHART

STARTING WITH GITHUB

➣ Create your account on github.➣ Create a new repository in your profile.➣ Copy the repository url from github.➣ Open your terminal or bash application.

CONCEPT OF CLONING

In open source culture you can copy repository of any user and start contributing your code in it this process is called cloning.Execute following command to clone any user’s repository to your system :

$git clone url_repo

INITIALIZING GIT FOLDER

Execute following command to create a git folder in your directory:

$ git init

The folder created is hidden with .git extension.Use $git status command to monitor state of your git folder

ADDING FILE TO GIT FOLDER

Execute following command to add your document to your git folder:

$git add file_name

In case of adding multiple file use following command:

$git add .

COMMENTING TO GIT FOLDER

Execute following command to comment your added git file:

$git commit -m “comment”

Use $git status command to monitor state of your git folder

CREATING ORIGIN LINK

Execute following command to link your directory with current working repository:

$git remote add origin repository_url

PUSHING INTO REPOSITORY

Execute following command to push your document to your git repository:

$git push -u origin master

In case you want to push your document in another branch replace master with the name of that branch

PULLING FROM REPOSITORY

Pulling from repository is done to update your git folder with commit made by other people on your repository.Now use github GUI to create a new file in your repository, assume that this file is created by some other person in current repository.

PULLING FROM REPOSITORY CONT...

Execute following command to pull commits into your git folder:

$git pull repository_url

Use $git status command to monitor state of your git folder

THE END

STAY TUNED…WE WILL BE BACK WITH ADVANCE WORKSHOP ON GIT.