linux内核开源项目有着为数众多的参与者,绝大多数linux内核维护工作都花在提交补丁和保存归档的繁琐事务
创建git的目标:
速度
简单的设计
对非线性开发模式的强力支持(允许成千上万并开发的分支)
完全分布式
有能力高效管理类似linux内核一样的超大规模项目
自诞生2005年以来,git在高度易用的同时,任然保留初期的目标
已提交(committed):修改文件,但为保存数据库中
已修改(modified):对一个已修改文件的当前版本做了标记,使之包含在下次提交的快照中
已暂存(staged):数据已经安全地保存在本地数据库中
工作区:对项目的某个版本独立提取出来的内容。
暂存区:保存下次将要提交的文件列表信息
Git目录:Fit来保存项目的元数据和对象数据库的地方
在工作区中修改文件
将你想要下次提交的更改选择地暂存,这样只会将更改的部分添加到暂存区
提交更新,找到暂存区的文件,将快照永久性存储到Git目录
git自带一个git config的工具来帮助设置控制Git外观和行为的配置变量。
git config --list --show-origin(查看所有的配置以及他们所在的文件)
用户信息
安装git之后,第一件事就是设置你的用户名和邮箱地址 因为每个git提交都会使用这些信息;写入每一次提交是不可更改
文本编辑器
检查配置信息
获取帮助:在git获取帮助
git help
git --help
man git-
$ git help
usage: git [–version] [–help] [-C ] [-c =]
[–exec-path[= ]] [–html-path] [–man-path] [–info-path]
[-p | --paginate | -P | --no-pager] [–no-replace-objects] [–bare]
[–git-dir= ] [–work-tree= ] [–namespace=]
[]
These are common Git commands used in various situations:
various situations:各种情况 common :常见的
start a working area (see also: git help tutorial)
启动工作区
clone Clone a repository into a new directory
init Create an empty Git repository(存储库) or reinitialize(重新初始化) an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
restore Restore(还原) working tree files
rm Remove files from the working tree and from the index
sparse-checkout Initialize and modify the sparse-checkout
examine(检查) the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
diff Show changes between commits, commit and working tree, etc
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak(调整) your common history
branch List, create, or delete branches
commit Record changes to the repository
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
reset Reset current HEAD to the specified state
switch Switch branches
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
‘git help -a’ and ‘git help -g’ list available subcommands and some
concept guides. See 'git help ’ or 'git help ’
to read about a specific subcommand or concept.
See ‘git help git’ for an overview of the system.
将尚未进行版本控制的本地目录转换为Git仓库
从其他服务器克隆一个工作Git仓库
创建一个git仓库
1.先进入项目目录
2.在用git init
该命令将创建一个名为.git的子目录,这个子目录含有初始化的Git仓库中所有的必须文件,这些文件是Git仓库的骨干,但是这个时候,我们仅仅是做了一个初始化的操作,你的项目里的文件还没有被跟踪。
git克隆是该仓库服务器上的所有数据(clone)其他的vsc使用checkout
eg:** git clone https://gitee.com/Montaro2017/html-pratice.git**
出现红色代表的是两个文件没有被git跟踪
对a.txt进行跟踪
git add a.txt
changes to be committed 说明以文件是以暂存状态;