github常用命令

Generating SSH Keys (创建SSH密钥)

https://help.github.com/articles/generating-ssh-keys#platform-linux


Create a repository (创建代码库)

 https://help.github.com/articles/create-a-repo


Pull changes (下拉更改)

(local unchanged, remote changed.)

$ git remote add origin git@github.com:username/project.git

$ git pull origin master

         [#]succeed


Push changes (上推更改)

(local changed, remote unchanged.)

$ git add .

$ git commit -m "local commit"

$ git remote add origin git@github.com:username/project.git

$ git push origin master

         [#]succeed

 

Conflict resolution (解决代码冲突)

(local changed, remote changed.)

$ git add .

$ git commit -m "local commit"

$ git remote add origin git@github.com:username/project.git

$ git push origin master

         ! [rejected]

$ git pull origin master

         CONFLICT (content)

你的源码文件内容会变为:

 <<<<<<< HEAD
your commit
=======
remote repository
>>>>>>> master

直接在源码文件内人为取舍代码。

然后再push:

$ git add .

$ git commit -m "local commit"

$ git push origin master

 

Download (下载代码)

$ git clone git://github.com/username/project.git 

这种情况下是不能push的。



参考:

Git/Github使用方法小记

http://artori.us/git-github-usage/

git - 简易指南

http://rogerdudler.github.io/git-guide/index.zh.html

如何高效利用GitHub - 阳志平

http://www.yangzhiping.com/tech/github.html

Pro Git book

http://git-scm.com/book/zh



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值