git

  1. git server set up
    1. apt-get install git-daemon-run
    2. ln -s /home/user/git/xxxProject/.git /var/cache/git/xxxProject.git
    3. touch /home/user/git/xxxProject/.git/git-daemon-export-ok
    4. sv restart git-daemon
    5. git clone git://ip(or hostname)/git/xxxProject
  2. git push
    1. Must use ssh protocol
    2. The .git/config file should change from git to ssh , if you use git to clone project
      #url = git://jsa8l/git/MyAndroid/
      url = ssh://root@jsa8l/mnt/sda/git/MyAndroid  
    3. Create Branch to track with origin
      git checkout --track -b <> origin/ <>
    4. Switch to new branch, and merges code to new branch.
    5. pull the branch code from remote
    6. Commit the code.
    7. Push code to remote git server.
  3. create patch
    1. For each commit a separate file is created in the current directory.
      $ git format-patch origin
  4. Command
    1. checkout : http://stackoverflow.com/questions/11990090/git-pull-based-on-sha
    2. rebase : http://rubyist.marsz.tw/blog/2012-01-17/git-reset-and-revert-to-rollback-commit/ http://ihower.tw/blog/archives/3843 http://blog.yorkxin.org/posts/2011/07/29/git-rebase
    3. service restart : sudo /etc/init.d/git-daemon restart
  5. Reference
    1. ubuntu
    2. git introduction
    3. Git_Guide
    4. git-format-patch
    5. How to create and apply a patch with Git

留言