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.关于版本控制 版本控制用于记录和追踪目录结构和文件内容变化,能够追溯过去的任何修改和变化,并恢复到任何历史状态. 版本控制系统可以按照发展过程分成以下几类: 目录备份.记录版本变化最 ...
随机推荐
- Wordpress 所有 hook 钩子
muplugins_loaded 在必须使用的插件加载之后. registered_taxonomy 对于类别,post_tag 等 Registered_post_type 用于帖子,页面等 plu ...
- 流程控制之 for 循环
目录 流程控制之for循环 for 循环条件语句 for 循环的嵌套 流程控制之for循环 for 循环条件语句 for i in range(3): print(i) # 0 # 1 # 2 for ...
- 史上最全的spark面试题——持续更新中
史上最全的spark面试题——持续更新中 2018年09月09日 16:34:10 为了九亿少女的期待 阅读数 13696更多 分类专栏: Spark 面试题 版权声明:本文为博主原创文章,遵循C ...
- C++入门基础知识(一)
一:关键字 在C语言中,我们已经学习过了很多的关键字,例如:static,struct等,下面展现一下C++中的一些关键字. 二:命名空间 在C/C++中,变量.函数和类都是大量存在的,这些变量.函数 ...
- windows上pip安装及使用详解
windows上pip安装及使用详解 2018-11-21 19:49:58 十二笔 阅读数 8229更多 分类专栏: Python学习 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA ...
- var正在声明变量
var正在声明变量也可以直接分配一个变量,而不在JS中声明它,但是这种变量在默认情况下是全局的.<!-/->是HTML中的注释,在JS中不起作用.它只是用来忽略无法识别脚本的浏览器的脚本内 ...
- ie8 下的半透明 background:rgba 与opacity失效 兼容办法
fliter: filter: progid:DXImageTransform.Microsoft.Alpha(opacity=70);
- java(堆、栈、常量池)
参考链接: https://www.cnblogs.com/wanson/articles/10819189.html
- 什么是PAM认证
PAM(Pluggable Authentication Modules )是由 Sun 提出的一种用于实现应用程序的认证机制.其核心是一套共享库,目的是提供一个框架和一套编程接口,将认证工作由程序员 ...
- Kernel boot options
There are three ways to pass options to the kernel and thus control its behavior: When building the ...