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.关于版本控制 版本控制用于记录和追踪目录结构和文件内容变化,能够追溯过去的任何修改和变化,并恢复到任何历史状态. 版本控制系统可以按照发展过程分成以下几类: 目录备份.记录版本变化最 ...
随机推荐
- DOS bcp
C:\>bcp /?用法: bcp {dbtable | query} {in | out | queryout | format} 数据文件 [-m 最大错误数] [ ...
- redis 慢查询、Pipeline
1.慢查询 简介 慢查询顾名思义是将redis执行命令较慢的命令记录下来,redis处理慢查询时是将慢查询记录到慢查询队列中 慢查询配置 slowlog-max-len 慢查询队列长度(记录多少条慢查 ...
- gRPC 本地服务搭建
RPC RPC 原理 主流 RPC 框架 gRPC 概述 特点 服务端创建 定义服务 生成 gRPC 代码 服务端实现 客户端实现 踩坑记录 源码 RPC RPC 原理 RPC 框架的目标就是让远程服 ...
- [HAOI2010]软件安装 题解
题面 这道题比较显然地,是一道树形背包: 但是会有环,怎么办呢? 缩点!tarjan缩点! 然后在新图上跑树形背包就可以AC了 #include <bits/stdc++.h> #defi ...
- 老贾的幸福生活day5 while循环 格式化 运算符 编码初识
while 循环 死循环 while 条件: print(结果) while 条件: print(结果) else: print(结果) break 终止当前循环 continue 跳出当前循环,进行 ...
- 【计数dp】Array Without Local Maximums
参考博客:[CF1068D]Array Without Local Maximums(计数DP) [题意] n<=1e5 dp[i][j][k]表示当前第i个数字为j,第i-1个数字与第i个之间 ...
- 解决github pages和github .md文件图片不显示
博客园上传的图片,在github上无法显示. 在github项目下建立img文件夹,放上图片 两种方式 项目绝对路径 https://raw.githubusercontent.com/用户名/项目名 ...
- ASP.NET Core如何限制请求频率
原文:ASP.NET Core如何限制请求频率 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明. 本文链接:https://blog.csdn.ne ...
- vue-cli3配置eslint
一.默认配置 以下是package.json文件中关于的eslint默认配置 "eslintConfig": { "root": true, "env ...
- JS基础_嵌套的for循环
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...