Git简介
Git是什么?
Git是目前世界上最先进的分布式版本控制系统(没有之一)
Git有什么特点?
高端大气上档次
Git如何产生的呢?
这是个比较有意思的故事,简单的来说,就是牛人对现有的版本控制工具感到不爽,干脆自己写一个得了。
牛人就是这么牛啊!(感觉自己好菜,望尘莫及)
牛人是当今最流行的服务器系统Linux创始人Linus。
Git也就是为了管理开发Linux发明的。
Git安装
我用的是windows 10 系统,直接去官网下载,像正常软件一样安装就行了。
若是其他系统,请自行查阅资料。
Quick Start
1. 创建仓库并初始化
建立一个空白文件夹(仅用学习使用)且进入。
在当前文件夹运行cmd(地址栏直接输入cmd)
初始化仓库
git init
第一次使用Git要注明身份。
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
把你的邮箱和姓名设置好(–global是全局设置),再进行下一步操作。
2. 建立一个文件提交进仓库
- 建立一个文件readme.md,编写内容:
This is my first to use git.
Hope I can success.
- 添加进仓库
git add readme.md
- 提交至Git仓库
git commit -m "add a new file named readme.md"
-m “…” 是备注信息,可写可不写,养成良好习惯要写一下。
- 查看仓库状态信息
git status
输出:
On branch master
nothing to commit, working tree clean
3.修改文件并提交
- 修改指定readme.md文档
This is my first to use git.
Hope I can success and is change.
- 查看一下状态
git status
输出:
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: readme.md
no changes added to commit (use "git add" and/or "git commit -a")
提示readme.md文件被修改了。
- 老规矩,先add 再commit
git add readme.md
git commit -m "update readme.md"
查看状态信息git status
On branch master
nothing to commit, working tree clean
ok,目前已经启动了Git,并且学会了如何修改和提交文件,接下来就是如何进行**时空穿梭**了。