git简单使用

简单记录一下,git讲解很多,这里记录一下大体步骤。

1.首先在github.com上申请一个空间,然后在本机建立一个目录:

mkdir gittest

2.在该目录中建立一个文件:

touch README.md

3.初始化版本库

git init

4.增加文件到版本库

git add README.md

5.提交更改

git commit -m "first commit"

6.增加远程库

git remote add origin https://github.com/garfieldtom/python.git

7.提交到远程库 (增加到远程库完毕后以后有更改直接执行提交到远程库即可)

git push -u origin master

8.OK,完工!

git分支操作:

 1.建立分支

 git branch python3

2.切换分支

git checkout python3

3.切换到主分支

git checkout master

4.查看当前的状态

git status

5.查看日志

git log

6. 图形方式查看版本信息

gitk

原文地址:https://www.cnblogs.com/GarfieldTom/p/2800194.html