git

一、git和github
  • git:版本控制工具。
  • github:提供git仓库托管服务的平台。
  • 用git控制版本,用github托管git仓库到网络。
 
二、git
  • 初始化配置github的用户名和邮箱
    • git config --global user.name "your name"
    • git config --global user.email "email@email.com"
  • 创建git仓库
    • git init:把当前目录设置为git仓库
  • 添加文件到版本库
    • git add 文件名:把仓库下的文件添加到版本库
  • 查看仓库状态
    • git status:查看仓库内文件的修改、添加、提交状态
  • 查看文件修改情况
    • git diff 文件名
  • 把文件提交到仓库
    • git commit -m “注释”:提交所有的修改
  • 查看历史纪录
    • git log:查看历史提交记录
  • 回退到上一次提交
    • git reset --hard HEAD^
  • 添加远程仓库:把当前仓库与远程仓库关联
    • git remote add origin git@github.com:用户名/仓库名.git
  • 查看远程仓库地址
    • git remote -v
  • 生产ssh key:git和github仓库之间使用ssh加密
    • ssh-keygen -t rsa -C "邮箱"
    • 把id_rsa.pub中的公钥复制到github上
  • 若github仓库为空,第一次push
    • git push -u origin master
    • 第一次关联后,后续就可以用:git push origin master
  • 若github仓库不为空,需先pull下来,再push
    • git pull origin master --allow-unrelated-histories
  • 克隆github仓库到本地
    • git clone git@github.com:用户名/仓库名.git
 
三、github
  • star:给项目点赞。
  • watch:关注项目动态。
  • follow:关注作者动态。
  • fork:在自己的github仓库中建立原项目的一个分支,修改后可以pull request到原项目,经作者同意后可以整合到原项目中。
  • 删除github仓库中的分支:
    • git push origin :分支名
 
 

转载于:https://www.cnblogs.com/ruowei/p/10851959.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值