git的使用

1、安装好git后,进入某个文件夹,运行:

git clone http://github.com/xxxx/xxxx.git (可以到github 的repository 的右上角 clone or dowload 获取)

2、修改代码后,查看哪些代码有改动,通过

  git diff master

3、 有改动的代码会以红色标注。提交过程如下:

  (1) git add filename , filename

  (2)  git commit -m "init comit"

  (3) git push -u origin master

4、添加 repository

  git remote add name http://github.com/用户名/xxx.git

5、切换 repository

 git checkout xxx

6、查看分支

git branch -r

7 、创建分支

git branch xxx

切换 branch 也一样

8、切换 以前的版本

git log 查看提交的评论 

 git checkout  hash值

9 查看 远程库

git remote -v

原文地址:https://www.cnblogs.com/williamcai/p/6193396.html