1、下载
2、安装完以后,点击程序-git-git bash
$ git config --global user.name "Your Name"
$ git config --global user.email "email@example.com"
3、cd /d/wamp/www 到项目目录当中
4、创建版本库
$ mkdir learngit
$ cd learngit
$ pwd
显示项目的路径
5、通过git init
命令把这个目录变成Git可以管理的仓库:
$ git init
Initialized empty Git repository in
6、上传文件到版本库
编写一个文件 readme.txt
Git is a version control system.
Git is free software.
添加到git仓库当中 add可添加多个
$ git add readme.txt
提交
$ git commit -m "wrote a readme file"
[master (root-commit) eaadf4e] wrote a readme file
1 file changed, 2 insertions(+)
create mode 100644 readme.txt
git commit
命令,-m
后面输入的是本次提交的说明
$ git add file1.txt
$ git add file2.txt file3.txt
$ git commit -m "add 3 files."
7、修改readme.txt 文件
Git is a distributed version control system.
Git is free software.
运行git status
$ 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")
查看详细的修改信息 git diff
$ git diff readme.txt
diff --git a/readme.txt b/readme.txt
index 46d49bf..9247db6 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,2 +1,2 @@
-Git is a version control system.
+Git is a distributed version control system.
Git is free software.
提交修改和提交新文件是一样的两步