Tuesday 28 December 2010

basic git command

git is the fast version control system

Now I am studying how to use git

  • Here are the commands for common using:
  1. Use git clone to check out sources. i.e. Download pulseaudio sources:
    git clone git://git.0pointer.de/pulseaudio.git
    
  2. Use git status to show your working tree status
    git status
    
  3. Use git pull to update the codes to the newest version
    git pull origin master
    
  4. Add or edit your file
  5. Commit your new file
    git add your-file
    
    git commit -m 'log'
    
  6. Push your change to remote repository
    git push origin master
    

  • Here is a sample to generate a patch
    git status
    
    view /home/usr/.gitconfig 
    
    git add src/pulsecore/random.c
    
    git log -v
    
    git commit -m 'core: Fix variable "has_whined" value bug'
    
    git format-patch -s -1
    
    view 0001-core-Fix-variable-has_whined-value-bug.patch
    

No comments:

Post a Comment