KEMBAR78
Linux GIT commands | PPTX
Linux GIT commands 
Raj Kumar Rampelli
What is Git in linux 
 Distributed revision/version control system and Source 
code manager 
 Features: 
 Speed 
 Data Integrity 
 Distributed & Non linear work flow 
 More info: try 
man git 
 Source: [Wikipedia]
Frequently used git commands 
 Git <command> --help 
 git status 
 List the files changes in current working directory 
 git diff 
 Show the changes to track the files 
 git diff <commit_id1> <commit_id2> 
 Show the changes between commit ids id1 and id2 
 git diff <branch1> <branch2> 
 Show the changes between branch1 and branch2
Git commands-2 
Command Use 
git log Changes history in the current 
working branch. List all changes 
that are merged in this branch 
git log <file_name> Change history of specified file 
git show <commit_id> Show the exact change in the 
specified commit id 
git show <branch_name> Show the last commit id 
information in the specified 
branch 
git branch List all local branches, and * 
indicates the current branch 
git branch –a | head List the root branch name for 
this branch, i.e. upstream 
repository name
Git commands-3 
Command Use 
git checkout –b <branch_new> 
<branch_repository> 
Creates a branch based on the 
other branch 
(branch_repository) and switch 
to new branch (branch_new) 
git checkout <branch> Switch to already existing local 
branch 
git branch –d <branch_name> Deletes branch 
git pull Pulls the latest changes from 
origin and merge them 
Git fetch Fetch the latest changes from 
origin but not merge locally. 
git add <file_name> Add files to the index 
git commit Record the changes to the 
repository
Git commands-4 
Commands Use 
git push Update remote refs along with 
associated objects 
Git rebase Forward-port local commits to 
the updated upstream head 
git reset Reset current HEAD to the 
specified state 
git revert <commit_id> Revert/delete exisitng commit 
git blame <file_name> Show changes in the file and 
author last modified each line 
of a file 
git help Display help info about git
Finding regression using 
git bisect command 
 Step1: git bisect start 
 Step2: git bisect good <commit_id> 
 Last working commit id 
 Step3: git bisect bad <commit_id> 
 This commit id is last broken version 
 Step4: New commit id will be generated in step3. 
 Now, HEAD is at this new commit id. 
 Build, flash the device and check the current version of code is 
working or broken. 
 If broken, then new commit is bad 
 Else, the new commit is good 
 Now, assign this commit id to good/bad commit id and follow the 
same steps from step2 till you find the culprit commit. 
 Please check the discussion at 
http://stackoverflow.com/questions/4713088/how-to-use-git-bisect
THANK YOU  
Have a look at 
My PPTs: www.slideshare.net/rampalliraj/ 
My Blog: http://practicepeople.blogspot.in/

Linux GIT commands

  • 1.
    Linux GIT commands Raj Kumar Rampelli
  • 2.
    What is Gitin linux  Distributed revision/version control system and Source code manager  Features:  Speed  Data Integrity  Distributed & Non linear work flow  More info: try man git  Source: [Wikipedia]
  • 3.
    Frequently used gitcommands  Git <command> --help  git status  List the files changes in current working directory  git diff  Show the changes to track the files  git diff <commit_id1> <commit_id2>  Show the changes between commit ids id1 and id2  git diff <branch1> <branch2>  Show the changes between branch1 and branch2
  • 4.
    Git commands-2 CommandUse git log Changes history in the current working branch. List all changes that are merged in this branch git log <file_name> Change history of specified file git show <commit_id> Show the exact change in the specified commit id git show <branch_name> Show the last commit id information in the specified branch git branch List all local branches, and * indicates the current branch git branch –a | head List the root branch name for this branch, i.e. upstream repository name
  • 5.
    Git commands-3 CommandUse git checkout –b <branch_new> <branch_repository> Creates a branch based on the other branch (branch_repository) and switch to new branch (branch_new) git checkout <branch> Switch to already existing local branch git branch –d <branch_name> Deletes branch git pull Pulls the latest changes from origin and merge them Git fetch Fetch the latest changes from origin but not merge locally. git add <file_name> Add files to the index git commit Record the changes to the repository
  • 6.
    Git commands-4 CommandsUse git push Update remote refs along with associated objects Git rebase Forward-port local commits to the updated upstream head git reset Reset current HEAD to the specified state git revert <commit_id> Revert/delete exisitng commit git blame <file_name> Show changes in the file and author last modified each line of a file git help Display help info about git
  • 7.
    Finding regression using git bisect command  Step1: git bisect start  Step2: git bisect good <commit_id>  Last working commit id  Step3: git bisect bad <commit_id>  This commit id is last broken version  Step4: New commit id will be generated in step3.  Now, HEAD is at this new commit id.  Build, flash the device and check the current version of code is working or broken.  If broken, then new commit is bad  Else, the new commit is good  Now, assign this commit id to good/bad commit id and follow the same steps from step2 till you find the culprit commit.  Please check the discussion at http://stackoverflow.com/questions/4713088/how-to-use-git-bisect
  • 8.
    THANK YOU  Have a look at My PPTs: www.slideshare.net/rampalliraj/ My Blog: http://practicepeople.blogspot.in/