git教程2-git基础

clone

使用IDE,直接在vcs里,从git checkout,方便。python

commit

commit是提交到本地git仓库,本质是作一次存储快照。git

能够屡次commit以后,再次push到git服务器。服务器

status

https://git-scm.com/book/zh/v1/Git-基础-记录每次更新到仓库ide

$ git status
On branch master
Your branch is up to date with 'origin/master'.

#当从git上clone一个项目下来后(使用IDE PyCharm的Py项目),看status,会告诉我个人分支和master是update to date的。

  

$ git status
On branch master
Your branch is up to date with 'origin/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:   run.sh

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        lic

no changes added to commit (use "git add" and/or "git commit -a")
#添加新文件,IDE会提醒添加到git,若是没有添加,文件为红色,commit时能够选择添加到版本控制
#修改git上已有文件,会变蓝色,表示已修改。

ignore

在根目录建立.gitignore文件,这样就会忽略一些文件,不被提交到gitidea

#忽略pyc,DS_Store结尾文件,忽略.idea/,migrations/下的文件,
.pyc
.idea/
.DS_Store
migrations/
.log

log

在IDE的version control log中,能够查看每一个分支的提交msssage,提交人,时间,更改的内容。版本控制

 

diff

 点击文件,git-show history,能够比较不一样历史commit版本之间的差异blog

在commit时,也能够对文件比较和上一次commit之间的差异it

 

 revision

每次commit以后都会有一个revision,每一个文件都有本身的revision。这个revision是哈希计算的。io

git会根据这个作文件完整性校验,因此不能在git不知情的状况下更改文件和目录内容ast

相关文章
相关标签/搜索