You are on page 1of 2

download :

git-sct.com/download
update git if already installed
git update-git-for-windows
check version
git version
intial configuration
user name and email address
either can confirgure globally which you can use for all the repository
or for specific repository also can configure
global configuration
git config --global user.name sumit
git config --global user.email sumit@gmai.com

get cofiguration
git config --global --list
===============================================
create a git repo
- create a directory which work as
workspace
- e:
- mkdir git-workspace
- cd git-workspace (normal directory)
- dir
- git init (normal directory converted into git repository)
- dir -all
- cd .git
- dir
- cd ..
-
===============================================
git - file life cycle
untracked => unchanged => modified => staged
===============================================
implementing life cycle
add command
- moves the files from untracked state to traced state and the staging area
- if files are in tracked stated, then move the changes to the staging area
- Optionally pass the . operator to move all the new / modified / deleted files to
the staging area

use git status command to get the status of the files


- first lines shows in which branch you are
- second line : how many commits are done
- third line : how many files are untracked\

git add users.json


git status

git commit
- commit command tracks following
- who made the changes : from profile
- when changes : based on timestamp
- why : user need to pass msg

Ex:
git commit -, "intial commit"
git status
git log

Git command - commit


- commits the changes from the staging area to the repository
- Once committed, the changes cannot be undone
- A unique SHA-key is generated based on the content of the files
- Every commit will have a reference to its parent commit
- This forms the commit chain and hence Git maintains the integrity of the
repository

git - log command


- prints the log of all the commits in a desceding order of the committed
timestamp
- prints the commit information (who,when and why)
- useful to verify the commits and to switch to a specific commit
- can pass in optional arguments
-- online
-- pretty

Ex:
git log --oneline and check output
git log --pretty and check output

You might also like