Upgrade to Pro — share decks privately, control downloads, hide ads and more …

git 入门

Avatar for scottxu scottxu
July 29, 2014

git 入门

地图汇内部的git入门培训。

Avatar for scottxu

scottxu

July 29, 2014

More Decks by scottxu

Other Decks in Technology

Transcript

  1.  git add .  git commit –m “my first

    git test” 添加和提交
  2.  git remote add origin <server>  例如:  git

    remote add origin [email protected]:/home/code/dituhui.git 首次推送服务器上
  3.  git tag #列出tag的列表  git tag v1.0.0 #打标签 

    git push origin v1.0.0 #将本地标签推送到服务器端  git ls-remote origin #显示tag  git pull origin refs/tags/v1.0.0 git 里程碑
  4.  git diff 对比差异  git checkout filename(“.”代表全部)  git

    reset --hard origin/dev 放弃本地,恢复和dev一致 常用命令
  5.  ssh-keygen -t rsa #如果你有就不用这步了。  cat .ssh/id_rsa.pub | ssh

    {host}@{ip} 'cat>>.ssh/authorized_keys' git / ssh 不用每次都输入密码的方法
  6. git