Git Tutorial Crash Course
Git Tutorial Crash Course
Version Control System - It is developed to co-ordinate the work among the developers.
Features of GIT
Open Source – GPL license
Scalable- large number of users git can easily handle
Distributed- on another machine user can easily clone
Security-Secure, uses SHA1 (Secure Hash Function) to name and identify the objects
Speed-fast, most of the operation on local repo
Branching and Merging- great feature, multiple branches so that other developer work together.
Staging Area- preview of next commit.
Important Terminology
Branch- repository diverges from main working directory.
Checkout- checkout is used for the act of switching between different versions of a target entity
Clone: making copy from server.
Merge – combining branches
Origin- remote repository from a project was initially cloned
Pull- receive the data from Server (GITHUB)
Push- Upload local repository to sever.
Git Ignore-use for intentionally untrack the fine
Git Diff- shows changes between commit, working tree etc.
Git Rm- for removing files.
Etc.
Let start
Create a local repository:
$ git init
Make copy
$ git clone
Commit History
Display the most recent commits and status of the head.
$git log
$git log -p -2
Output as one commit per line
Ignoring Files
Create. gitignore file
Branching
List a branch
$git branch –-list
Create Branch
$git branch [name]
Delete Branch
$git branch -d [name]
Git checkout
Switch between branch in a repository
$git checkout [branch name]
Working on Remote
$git remote -v
Add remote to repository
$git remote add [name] [remote url]
Remove from
Delete the file
$git rm [file]
GITHUB
Repository Hosting Service
Remote Repository:
Git remote add name url
Git remote -v
Git push -u origin master