1. Installation and Setup
(1) Git installation (slightly)
(2) Initialization settings
$ git config--global user.name "Lihuasun"
$ git config--global user.email "12***[email protected]**.com"
$ git config--global push.default matching #向后兼容新的git版本
(3) The first time to use the warehouse to do the setup
$ git init
$ git add-a
$ git status
$ git commit-m "Initialize repository"
$ git log
(4) Public Key Management
$ ssh-keygen-t rsa-c "[email protected]" #生成公钥
$ cat ~/.ssh/id_rsa.pub #复制公钥
(5) Add Hello_app Warehouse on GitHub (slightly)
(6) Add remote repository and push
$ git Remote add origin [email protected]:lihuasun/hello_app.git
$ git push-u origin--all #第一次推送仓库
2. Branch, edit, submit, merge, push
(1) Branch
$ git checkout-b modify-readme #创建分支
$ git Branch #查看分支
(2) Edit
$ git mv Readme.rdoc readme.md
$ git checkout-f #强制撤销改动
(3) Submit
$ git status #查看分支状态
$ git add-a #如果上次提交之后添加了新文件, you want to execute this command
$ git commit-a-M "Improve the README file"
(4) Merger
$ git Checkout master #切换到主分支
$ git merge Modify-readme #合并分支
$ git brandh-d modify-readme #删除分支, when using-D, discard changes in the branch
(5) Push
$ Git push origin master #其中origin master often omitted
Ruby on Rails Tutorial the first chapter of GIT project management