[关闭]
@haozhihao 2017-09-21T07:17:12.000000Z 字数 989 阅读 753

git 学习

Git


创建仓库repository

  1. $mkdir first
  2. $cd first
  3. $pwd

其中pwd命令用于显示当前目录,mkdir创建目录,cd 进入目录
然后通过git init初始化命令,把first目录编程Git管理的目录

  1. $git init

常用功能

1、git status命令查看仓库的状态

  1. john@john-PC MINGW64 ~/haozhihao.github.io (master)
  2. $ git status
  3. On branch master
  4. Your branch is up-to-date with 'origin/master'.
  5. nothing to commit, working directory clean

2、git log查看版本的历史记录,所有的版本从最近到最远所有的记录都可以显示出来

  1. john@john-PC MINGW64 ~/haozhihao.github.io (master)
  2. $ git log
  3. commit 29eaed15206bd435267f15d37ac843f6868da927
  4. Author: haozhih <haozhi118@126.com>
  5. Date: Thu Sep 14 12:33:08 2017 +0800
  6. zouxian
  7. commit 18e93c28cfcf255b9054f3b16abdddd80ebecd77
  8. Author: haozhih <haozhi118@126.com>
  9. Date: Mon Aug 14 13:07:44 2017 +0800
  10. original
  11. commit f6b88b1179802319b9e8db8d33f38a5191de47ac
  12. Author: haozhih <haozhi118@126.com>
  13. Date: Mon Aug 14 12:32:04 2017 +0800
  14. back
  15. commit 5b7d3a067dfe5cee1a15261bc36d1b913edc7cf2
  16. Author: haozhih <haozhi118@126.com>
  17. Date: Mon Aug 14 12:03:33 2017 +0800
  18. error

3、git reset如果想找曾经的版本,可以使用此命令

分支管理

1、git checkout -b创建分支,其中-b表示创建并且换,也可以用两条命令git branch创建和git checkout切换命令
2、git merge合并指定分支到当前分支
3、git branch -d删除当前分支

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注