Git presentation

download Git presentation

If you can't read please download the document

Transcript of Git presentation

whoami ??

Vikas S Yaligar

https://github.com/vikassy

@vikasyaligar

Why learn git??

To manage your Project repository

Sharing your code via github

Contributing to others code

Contents

Git Introduction

Git Basic Commands

Git Branching & Merging

Github Introduction

Your app in Github

How to Contribute?

Git Is

Open Source

Distributed Revision control

Source code management

Version control System

Tool for keeping a history on the state of your source code projects.

Linus Torvalds

I'm an egotistical bastard, and I name all my projects after myself. First 'Linux', now 'git'

Installation

On Linux sudo apt-get install git

Other systems

http://git-scm.com/

git --version

Version of git

Git work flow

Git Basic Commands

git init //initializes git

git status //prints status of current repo

git diff //prints difference made in files

git add filename //adds file name

git commit -m Message here :P //saved!!

git log //history

git init

Creates a .git file in current folder

Why??

Because

To tell git from where the file must be tracked !!!

git add

To add particular files/folders to commit

Examples:

git add .

git add test.c

git add somedirectory/file

How do I know which are added ?

Using git status

git status

about untracked files and files added to commit

Tells us

How do i know what are the changes?

git diff

Tells the changes made in files

git commit

git commit -m message here

git commit -am message here:P

-m => message

Message is compulsory !!

-a => To add the modified files and then commit

git log

To show all commits with messages,check sum and many more

Checksum is always unique to each commit

Can also use gitk, a commit viewer of git

How does it work??

.gitignore

Tells git what to Ignore

Status & Review

Git Introduction

Git Basic Commands

Git Branching & Merging

Github Introduction

Your app in Github

How to Contribute?

Git Branching & Merging

git branch //Shows all branches of currrent repo

Git creating branches

Git branch branch_name

Commit in Branch

git commit -am Message

git checkout branch_name

Goes to the branch

git add .

Other options

git checkout -b branch_name

Creates new branch and goes to that branch

git branch -d branch name

Deletes the given branch

Merging

git merge master branch_name

Used to merge your work with master

After merging

Oh! I have to go back to last commit !!!

How do I do that ???

git checkout checksum_number

You will have same status as that commit's data !!

Concept: It goes to a no branch state, one can make edits and also commit. But then you need tocreate that into new branch

Status & Review

Git Introduction

Git Basic Commands

Git Branching & Merging

Github Introduction

Your app in Github

How to Contribute?

Github

Who uses github ???

Many More !!!!

GitHub is the best way to collaborate with others. Fork, send pull requests and manage all your public and private git repositories.

Creating a new repo

Git remote

Then you can ask Git to fetch data from it that you dont have yet, or push your commits up to it (if you have write access).

A remote in Git is basically a way to tell Git whereanother version of your repository is.

Git remote add origin https://github.com/username/project.git

Fork a repo !!

Git clone

git clone new_repo_url your_name

Creates a repo by your_name

Adding upstream

git remote add upstream

https://github.com/username/rep.git

Adds remote named upstream for your current repo

Fetch

git fetch upstream

Fetches all the changes made to the original repo from whom you have forked

Merge

Git merge upstream/master

Merges the upstream with master branch

Git pull

Directly pulls the update from the original repo to your current working repo

There is a lot more to be learnt

Thank you !!

Credits:

1)Chandramouli , 3rd year , BTech.

2)Tushar Makkar , 2nd year, BTech.

3)Pramati , 2nd year , BTech .

Muokkaa otsikon tekstimuotoa napsauttamalla

Muokkaa jsennyksen tekstimuotoa napsauttamallaToinen jsennystasoKolmas jsennystasoNeljs jsennystasoViides jsennystasoKuudes jsennystasoSeitsems jsennystasoKahdeksas jsennystasoYhdekss jsennystaso

Muokkaa otsikon tekstimuotoa napsauttamalla

Muokkaa jsennyksen tekstimuotoa napsauttamallaToinen jsennystasoKolmas jsennystasoNeljs jsennystasoViides jsennystasoKuudes jsennystasoSeitsems jsennystasoKahdeksas jsennystasoYhdekss jsennystaso

Click to edit the title text format