git的使用

git的使用

1.什么是git

Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的分布式版本控制系统。

2.安装git

awk
复制代码
   1.https://git-scm.com/download/win
   2.下载安装成功
   3.win+R  -> cmd进入
   3.输入git 或 git --version  查看git版本

3.使用git

git config --global user.name “…” —提交人的信息,方便别人查看

git config --global user.email “” -----注意空格,本人因为空格多次失败

1.git init – 初始化工程

2.git status – 查看目前的状态

3.git add . – 就是将工作区的代码添加到暂存区 .的意思代表 all

4.git commit -m “” – commit是提交的意思 -m “注释的内容”

5.git log – 查看版本库中有哪些版本

6.git diff – 查看提交前后的不同,有+ -标注

7.git reset --hard “” hard后跟一大串字符,输入字符回到之前版本

9.git branch – 创建分支

10.git remote --使用远程仓库

11.git clone --克隆远程仓库

4.使用远程仓库?

awk
复制代码
github,上传github仓库代码 --先注册一个账号
   1. git remote add origin https://github.com/hjyl-cheng/mygittest.git
   2. git push -u origin master

   git remote add origin https://gitee.com/ebonc/mygittest.git
   git remote remove  --去除origin变量 防止冲突
    
   完整的流程开发的代码
   1.git init
   2.git status
   3.git add .
   4.git commit -m ""
   5.git remote add origin https://github.com/hjyl-cheng/mytest2.git
   6.git push -u origin master

5.免密上传到云端仓库

sql
复制代码
 1)在本地生成公私钥
      ssh-keygen -t rsa -- 生成公私钥
    2)将公钥放到github上去
    3)ssh -T git@github.com
   
    使用免密上传步骤
    1)git init
    2)git add .
    3)git commit -m ""
    4)git remote add origin git@github.com:hjyl-cheng/mytest3.git -- 地址是SSH地址,不是http地址!!!
    5)git push origin master
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值