git
首先是down 一个了,这里就省略了(以下为linux 下的使用, 其他系统会有不同)
配置git
1.通过命令 git config --global user.name "yourname"
git config --global user.email "your email"
2.或者通过修改配置
进入主目录 cd ~/ 然后vim .gitconfig 打开配置文件, 然后 添加 [user] name = "your name" email = "your email" 即可
初始化:
1. 使用 git init 这时候初始化仓库,然后可以在本目录下创建自己的工程了, 比如创建一个文件 touch heh.c , 这时候可以将你的hehe.c 加入到仓库中,使用 git add hehe.c
git commit -m "add the hehe to the git"
2. 可以通过git clone [远程或本地仓库] 将其他仓库clone 到本地一份, 这个也主要是用于初始化仓库
常用命令
git add hello.c 告诉git hello.c 改动了, 跟踪他
git commit -m "改动描述" 当***改动了, add只是跟踪, 并没有加入到库中,现在将改动提交到库中
git status 检查当前状态 如果改动了本地文件, 它会显示让你去 add这个改动, 如果add了一个改动, 他会提示去将这个改动添加到仓库
比如说: git add hello.c 会显示:
$ git add hello.c $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # modified: hello.c
继续 git status 会有
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: hello.c
#
查询历史
git log
可以查询历史
。。。时间原因, 会有更新