pro git 读书笔记 1
Git 1 - Getting Started
Git 的特点
- Git 存储每个版本的快照;其他 VCS(版本控制系统) 存储两个版本的变化之处
- 好处参考 Git 分支章节
- Git 几乎所有操作都是本地的;其他 VCS 需要远程服务器
- 这是因为 Git 在本地磁盘上有项目的整个历史.好处有两点,其一,访问速度很快;其二,断网时同样可以使用,upload 时再联网即可。
- Git 具有完整性
- store 之前,先进行 SHA-1 哈希算法校验,将检验和(40位16进制数)与其联系,所以每次修改 Git 都能知道。在 Git 数据库中不是以文件名存储,而是以它内容的哈希值存储。
- Git 一般只 Add 数据,而不删除;其他 VCS,你可能丢失你没有 commit的数据
- 更多关于 Git 如何存储数据,怎样恢复看似丢失的数据,请看 Undoing Things
三种状态(重点)
- committed:数据安全存入本地数据库
- modified:你修改了数据,但没有 commit 到本地数据库
- staged:你已经标记了 modified 文件到当前版本,进入下一个 commit 快照
这把我们引向 Git 项目的三个主要 section:
- Git directory:Git stores the metadata and object database for your project. This is the most important part of Git, and it is what is copied when you clone a repository from another computer.
- working directory:a single checkout of one version of the project. These files are pulled out of the compressed database in the Git directory and placed on disk for you
- staging area:a file, generally contained in your Git directory, that stores information about what will go into your next commit. It’s sometimes referred to as the “index”, but it’s also common to refer to it as the staging area.
基本的 Git 工作流如下:
- You modify files in your working directory.
- You stage the files, adding snapshots of them to your staging area.
- You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
If a particular version of a file is in the Git directory, it’s considered committed. If it’s modified but has been added to the staging area, it is staged. And if it was changed since it was checked out but has not been staged, it is modified. In Chapter 2, you’ll learn more about these states and how you can either take advantage of them or skip the staged part entirely.
Git 安装及配置
安装 msysGit (略),之后进行配置,主要是设置用户名和邮箱。
Git 自带工具 git config, 可以存储在三处:
- /etc/gitconfigfile: Contains values for every user on the system and all their repositories. If you pass the option --systemto git config, it reads and writes from this file pecifically.
- ~/.gitconfigor ~/.config/git/configfile: Specific to your user.You can make Git read and write to this file specifically by passing the --globaloption.
- config file in the Git directory (that is, .git/config) of whatever repository you’re currently using: Specific to that single repository.
优先级递增,如.git/config 会覆盖 /etc/gitconfig.
On Windows systems, Git looks for the .gitconfigfile in the $HOMEdirectory (C:\Users$USERfor most people). It also still looks for /etc/gitconfig, although it’s relative to the MSys root, which is wherever you decide to install Git on your Windows system when you run the installer.
pro git 读书笔记 1的更多相关文章
- Pro Git 读书笔记
一. 起步 1. 集中式版本控制缺点:中央服务器的单点故障. 分布式版本控制优点:客户端并不只提取最新版本的文件快照,而是把代码仓库完整地镜像下来. 这么一来,任何一处协同工作用的服务器发生故障,事后 ...
- Pro Git读书笔记 - 分支
Git 分支介绍. 几乎所有的版本控制系统都以某种形式支持分支. 使用分支意味着你可以把你的工作从开发主线上分离开来,以免影响开发主线. 在很多版本控制系统中,这是一个略微低效的过程--常常需要完全创 ...
- Pro Git读书笔记 - Git 常用命令
在工作目录中初始化新仓库 要对现有的某个项目开始用 Git 管理,只需到此项目所在的目录,执行git init 检查当前文件状态 要查看哪些文件处于什么状态,可以用git status命令 将工作文件 ...
- pro git 读书笔记 3 Git 分支
分支 新建分支:git branch 分支名 切换到该分支:git checkout 分支名 补充:以上两条语句等价于一句:git checkout -b 分支名 转换分支的时候最好保持一个清洁的工作 ...
- pro git 读书笔记 2
Git 2 - Git Basics 1 add github 上建立新的 repository,命名 demo git clone 到本地 github 目录 将自己之前的项目 copy 到该 de ...
- 《Pro Git》笔记3:分支基本操作
<Pro Git>笔记3:Git分支基本操作 分支使多线开发和合并非常容易.Git的分支就是一个指向提交对象的可变指针,极其轻量.Git的默认分支为master. 1.Git数据存储结构和 ...
- Pro Git 学习笔记
Pro Git 学习笔记 文档地址:Pro Git原文地址:PRO GIT 学习笔记 git常见命令 1.Git起步 初次运行Git前的配置 用户信息 git config --global user ...
- 《Pro Git》笔记2:Git基础操作
第二章 Git基础 Git基础包括:版本库的创建和获取,文件添加修改提交等基本操作,状态查询,远程版本库管理和同步,打标签. 1.取得项目的Git版本库 基于Git的工作流要以Git版本库为基础,即可 ...
- 《Pro Git》笔记1:起步
第一章 起步 1.关于版本控制 版本控制用于记录和追踪目录结构和文件内容变化,能够追溯过去的任何修改和变化,并恢复到任何历史状态. 版本控制系统可以按照发展过程分成以下几类: 目录备份.记录版本变化最 ...
随机推荐
- [转帖]【架构系列】龙芯loongson简介
[架构系列]龙芯loongson简介 https://blog.csdn.net/SoaringLee_fighting/article/details/97759305 2019年07月30日 10 ...
- 【Python】【demo实验11】【练习实例】【三个整数的立方和】
目的:找到 除了9n±4型自然数外,所有100以内的自然数都能写成三个整数的立方和 这每个数的表达方式: 源代码: #!/usr/bin/python # encoding=utf-8 # -* ...
- CentOS7之yum仓库配置
操作系统版本:CentOS Linux release 7.2.1511 (Core) Yum软件版本:yum-3.4.3-132.el7.centos.0.1.noarch Yum主配置文件:/ ...
- 记一次Sqoop抽数据异常
1. 环境 Hadoop Sqoop awsEMR 2.8.5 1.4.7 5.26.0 2.错误描述 在使用Sqoop抽取MySQL数据时,使用hdfs作为缓存,s3作为hive的存储地址,命令如下 ...
- 小记--------spark的宽依赖与窄依赖分析
窄依赖: Narrow Dependency : 一个RDD对它的父RDD,只有简单的一对一的依赖关系.RDD的每个partition仅仅依赖于父RDD中的一个partition,父RDD和子RDD的 ...
- c语言中int long float double 等类型所占字节及输出表示(转)
16位编译器 char :1个字节 char*(即指针变量): 2个字节 short int : 2个字节 int: 2个字节 unsigned int : 2个字节 float: 4个字节 doub ...
- Yii2.0 queue
https://www.yiichina.com/tutorial/1635 https://my.oschina.net/gcdong/blog/3031113 https://www.yii-ch ...
- php修改替换数据库图片(文件)
<?php extract($_POST); $date = date('Y-m-d'); $file_name = $_FILES['image']['name'];//获取缓存区图片,格式不 ...
- SDL2 程序 编译 错误 及 解决方案
main函数应写为int main( int argc, char* args[] )而不是int main()形式 链接库时应注意顺序 mingw32;SDL2main;SDL2; ...
- vue页面中图片不显示解决
在做新版组态界面的时候,用vue框架实现,在配置页面图片的时候发现有一张图片明明页面输入的路径是对的可是图片就是不显示出来 现象: network页面资源也不报错,而且状态码竟然还是200,点prev ...