Git
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.
clear ### clear terminal
ls ### view file or directory list
git config --global user.name "username"
git config --global user.email "user@gmail.com"
ls ### view file or directory list
git config --global user.name "username"
git config --global user.email "user@gmail.com"
### first time
git config --list
### view user name and email
git init
### initiate project
ls -lart
### view all list(hidden or not hidden both)
git status
### view status( like untracked, unmodified, modified, staged) Tips: This Command after change
git add index.html
### single file going on staging area
git commit
### for commit file then open new window type Initial commit and press Esc :wq
git commit --m "comments"
### for commit file with comment/changes info
git commit -a -m
### for commit skip staging area Tips: this change not save staging area, so avoid it
touch about.html
### Create New file
git add .
### All File going on staging area
git add -A
### All File going on staging area
git checkout contact.html
### for matching last commit single file
git checkout -f
### for matching last commit all file
git log
### for all commit
git log -p -5
### for customize or watch commit number and q press for quit section
git diff
### compare staging area with working tree/directory
git diff --staged
### compare last staging area with working tree/directory
git rm file.html
### delete/remove from directory and remove from staging area
git rm --cached file.html
### remove from staging area
git status -s
### provide short status and show 2 character of status M(green-denote staging area)M(red- denote working tree)
touch .gitignore
### file do not commit or other operation or privacy in push and pull command (like mylog.log, *.log, /mylog.log, diroctry/ etc)
git branch feature1
### to create branch
git branch -b feature1
### to create branch or move
git checkout feature1
### to move branch
Remote Access
git remote add origin https://github.com/account/test.git
### copy paste from git repository origin is the name of url
git remote
### to check remote url
git remote -v
### to check remote url (fetch and push)
git push origin master
### to push file to github(only public, private generate a fatal error( repository not found ) )
git push -u origin master
### to push file to master branch by default only run command "git push"
git remote set-url git@github.com:account/test.git
### for Update or change url
git clone https://giturl foldername
### clone projects
for upload private project
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
eval $(ssh-agent -s)
git checkout 'branchname'
git push -u origin branchname
git config --list
### view user name and email
git init
### initiate project
ls -lart
### view all list(hidden or not hidden both)
git status
### view status( like untracked, unmodified, modified, staged) Tips: This Command after change
git add index.html
### single file going on staging area
git commit
### for commit file then open new window type Initial commit and press Esc :wq
git commit --m "comments"
### for commit file with comment/changes info
git commit -a -m
### for commit skip staging area Tips: this change not save staging area, so avoid it
touch about.html
### Create New file
git add .
### All File going on staging area
git add -A
### All File going on staging area
git checkout contact.html
### for matching last commit single file
git checkout -f
### for matching last commit all file
git log
### for all commit
git log -p -5
### for customize or watch commit number and q press for quit section
git diff
### compare staging area with working tree/directory
git diff --staged
### compare last staging area with working tree/directory
git rm file.html
### delete/remove from directory and remove from staging area
git rm --cached file.html
### remove from staging area
git status -s
### provide short status and show 2 character of status M(green-denote staging area)M(red- denote working tree)
touch .gitignore
### file do not commit or other operation or privacy in push and pull command (like mylog.log, *.log, /mylog.log, diroctry/ etc)
git branch feature1
### to create branch
git branch -b feature1
### to create branch or move
git checkout feature1
### to move branch
Remote Access
git remote add origin https://github.com/account/test.git
### copy paste from git repository origin is the name of url
git remote
### to check remote url
git remote -v
### to check remote url (fetch and push)
git push origin master
### to push file to github(only public, private generate a fatal error( repository not found ) )
git push -u origin master
### to push file to master branch by default only run command "git push"
git remote set-url git@github.com:account/test.git
### for Update or change url
git clone https://giturl foldername
### clone projects
for upload private project
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
eval $(ssh-agent -s)
git checkout 'branchname'
git push -u origin branchname
Comments
Post a Comment