Git Learning--Day01

1.安装Git(通过官网影像);
2.基本信息设置:

  git config --global user.name "ywangela"
  git config --global user.email "luckygirl666123@163.com"

global参数:说明我这台机器上所有的Git仓库都会使用这个配置,或者对某个仓库指定不同的用户名和Email地址,也是可以的。

3.创建版本库(仓库)

(1)创建空目录;

mkdir learngit(windows中,目录名切勿用中文名)
cd learngit
pwd

(2)将此目录变成Git可管理的仓库,即初始化仓库。

   git init

此时,当前目录下会多了一个.git的隐藏文件

4.上手编写文件

(1)编写readme.txt(touch readme.txt),其内容如下(vim
this is the first git version.

(2)使用git add将文件添加到仓库中,可多次使用

   git add readme.txt

warning: LF will be replaced by CRLF in readme.txt.

(3)使用git commit将文件提交到仓库中

   git commit -m "write the first file."

-m后写的是本次提交的说明

(4)修改readme文件,修改后为
this is the second git version.

(5)使用git status查看仓库当前状态
On branch master Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: readme.txt no changes added to commit (use "git add" and/or "git commit -a")

(6)使用git diff xxx 参看具体的修改内容
(7)重复第(1)(2)步,将第二次描述改为"write the second file."
(8)再次使用git status查看仓库当前状态
nothing to commit,working tree clean(git告诉我们当前没有需要提价的修改,并且,工作目录是干净的)

本文基于廖雪峰老师的git教程整理,附上教程地址:https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
git文档地址:https://git-scm.com/doc

今天是新的一天,我要努力学好技术 :)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值