一、仓库管理

➜ gittest git:(master) git config --local user.name "arunguang"
➜ gittest git:(master) git config --local user.email "arunguang@gmail.com" ➜ gittest git:(master) git config --local --list
user.name=arunguang
user.email=arunguang@gmail.com --global < --local(local优先级最高)

  

解释及实操:

(1)
git add readme.md #把该文件放入git暂存区,通过git管理起来.
git add -u #all tracked files in the entire working tree are updated,即把所有已经加到暂存区的文件的更新一块添加更新 git reset --hard #清理掉自commit以后暂存区的所有改变(非常危险)
--hard Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded.
(2)变更文件名
git mv readme.md README.md
(3)git log详解
git log #git log后面不加任何分支,默认是查看当前分支的修改历史
git log --all #查看所有分支的修改历史
git log --oneline #以简短的方式查看git提交的历史记录
git log -n 2 #限制显示查看git log提交历史记录的最近几条
(3)分支管理
git checkout -b temp c6d9fd798e3cb652bd2977663b9e7fcc391b711a #基于git log的某个点创建分支
git commit -am"second" #-a, --all Tell the command to automatically stage files that have been modified and deleted
git log --all --graph --oneline #以图形化的方式查看更改历史
* fe6b335 (HEAD -> temp) second
| * 3538299 (master) mv readme to README.md
|/
* c6d9fd7 On branch master Changes to be committed: modified: readme.md
* 621445a xxx1
(4)查看帮助
git help -web log #以网页方式查看帮助
(5)gitk #图形管理工具

二、.git目录解密

(1)
➜ .git git:(temp) cat HEAD
ref: refs/heads/temp #指向当前的所在分支
cat .git/config
[core]
repositoryformatversion = 0
....
[user]
name = arun6688 #更改git的user.name的配置
email = arunguang@gmail.com
➜ gittest git:(master) git config --local user.name #再次查看已经更改了
arun6688
➜ gittest git:(master) git config --local user.name 'arunold' #再次查看config文件也已经更改了
(2).git/refs/ 目录
➜ heads git:(master) cat master
3538299062b25ce5e36e9467d0c204837f273fcb
➜ heads git:(master) cat temp
fe6b335bcca87443dd907668bd2ce388f14eddc2
➜ heads git:(master) git cat-file -t 3538299062b25ce5e36e9467d0c204837f273fcb #-t查看对象命令
commit
➜ heads git:(master) git cat-file -t fe6b335bcca87443dd907668bd2ce388f14eddc2
commit
➜ heads git:(master) git branch -av
* master 3538299 mv readme to README.md
temp fe6b335 second
➜ tags git:(master) git cat-file -p 293406d5c363001f169321e3008053c445e1b521 #-p查看对象内容
object 3538299062b25ce5e36e9467d0c204837f273fcb
type commit
tag test1.0
tagger arunold <arunguang@gmail.com> 1544517262 +0800 this is tag test
(2)
➜ 35 git:(master) pwd
.git/objects/35
➜ 35 git:(master) ls
38299062b25ce5e36e9467d0c204837f273fcb
➜ 35 git:(master) git cat-file -t 3538299062b25ce5e36e9467d0c204837f273fcb #目录+文件名即是git对象的hash值
commit
➜ 35 git:(master) git cat-file -p 3538299062b25ce5e36e9467d0c204837f273fcb
tree 9a522cb3bad21d631a84b9264ffb315602fbb079
parent c6d9fd798e3cb652bd2977663b9e7fcc391b711a
author arunguang <arunguang@gmail.com> 1544512480 +0800
committer arunguang <arunguang@gmail.com> 1544512480 +0800 mv readme to README.md

三、commit tree  blob是git中主要的对象

tree对应的是文件夹.

四、常见的企业中使用的git写作方式

https://en.wikipedia.org/wiki/Rolling_release

https://www.git-tower.com/learn/git/ebook/cn/command-line/advanced-topics/git-flow

常用:https://guides.github.com/introduction/flow/

------------------------------------------------------------------------

一、文件管理

(1)git恢复删除文件

➜  git:(master) ✗ git ls-files --deleted
camel-agent-deploy-update.sh
➜ git:(master) ✗ git checkout -- camel-agent-deploy-update.sh
➜ git:(master) ls #看到已经恢复了
camel-agent-deploy-update.sh

(2)

git log             #查看git整个的提交目录日志
git log -p files #查看某个文件的详细修改记录

参考:http://blog.csdn.net/whu_zhangmin/article/details/18596665

三、分支管理

git branch -a看下ansible分支的名称
git checkout -b ansible分支 eg:git checkout -b ansible2 origin/ansible
pip install -e `pwd` #-e, --editable <path/url>   Install a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.

四、开发nginx代码的良好使用方式

为了不污染nginx本身的代码,所以一般开发人员会用git diff生成差异的patch文件,然后到真正编译上线的时候再根据diff出的patch文件apply到现有的代码上,这样新添加的代码就会添加到原有nginx代码上,再进行编译即可

git diff > add-ssl-status.patch       #生成patch文件
git apply add-ssl-status.patch #把patch文件的git差异变更代码加入到现有的nginx中

005_git专题的更多相关文章

  1. 2016年中国微信小程序专题研究报告

    2016年12月29日,全球领先的移动互联网第三方数据挖掘和分析机构iiMedia Research(艾媒咨询)权威首发<2016年中国微信小程序专题研究报告>. 报告显示,82.6%手机 ...

  2. [.NET领域驱动设计实战系列]专题二:结合领域驱动设计的面向服务架构来搭建网上书店

    一.前言 在前面专题一中,我已经介绍了我写这系列文章的初衷了.由于dax.net中的DDD框架和Byteart Retail案例并没有对其形成过程做一步步分析,而是把整个DDD的实现案例展现给我们,这 ...

  3. 转载:《.NET 编程结构》专题汇总(C#)

    <.NET 编程结构>专题汇总(C#) - M守护神 - 博客园http://www.cnblogs.com/liusuqi/p/3213597.html 前言     掌握一门技术,首要 ...

  4. 设计模式(Design Pattern)系列之.NET专题

    最近,不是特别忙,重新翻了下设计模式,特地在此记录一下.会不定期更新本系列专题文章. 设计模式(Design pattern)是一套被反复使用.多数人知晓的.经过分类编目的.代码设计经验的总结. 使用 ...

  5. arcgis api for flex之专题图制作(饼状图,柱状图等)

    最近公司给我一个任务,就是利用arcgis api for flex实现在地图上点(业务数据)直接显示饼状图以及柱状图的专题图制作,而不是通过点击点显示气泡窗口的形式来实现,这个公司已经实现了. 经过 ...

  6. supermap iclient for js 标签专题图(服务端)

    <!DOCTYPE><html> <head> <meta http-equiv="Content-Type" content=" ...

  7. 【原】Spark学习总结-六个专题

    最近从hadoop转向Spark了,学了一段时间了,准备写个专题,主要写pySpark的应用,主要计划是: 主题 内容概要 聚类(5.6) 1.几种常用的聚类算法:2.pyspark中聚类算法的应用( ...

  8. 【ESRI论坛6周年征文】ArcEngine注记(Anno/ Label/Element等)处理专题 -入门篇

    原发表于ESRI中国社区,转过来.我的社区帐号:jhlong http://bbs.esrichina-bj.cn/ESRI/viewthread.php?tid=122097 ----------- ...

  9. Endnote专题之--output style相关问题

    Endnote专题之--output style相关问题 1. 打开output style, Edit--->Output Styles--->选择要编辑的某个style模板,如下面的E ...

随机推荐

  1. (转)Spring文件上传,包括一次选中多个文件

    背景: http://www.cnblogs.com/lixuwu/p/8495275.html已经实现了单文件的上传和下载,多文件的上传是另一种情景,这里记录下来 实现过程 先说前台. 运行以后就是 ...

  2. 收藏:SQL重复记录查询 .

    来自:http://blog.csdn.net/chinmo/article/details/2184020 1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断select ...

  3. isinstance和issubclass,__getattribute__,__getitem__,__setitem__,delitem__,__str__(三十五)

    isinstance(obj,cls)检查是否obj是否是类 cls 的对象 issubclass(sub, super)检查sub类是否是 super 类的派生类 class Foo: def __ ...

  4. 将make的输出重定向到文件(转)

    原文:将make的输出重定向到文件 [用法] 1.想要把make输出的全部信息,输出到某个文件中,最常见的办法就是:make xxx > build_output.txt此时默认情况是没有改变2 ...

  5. SQL Server 关于CROSS APPLY 和 OUTER APPLY应用

    先看看语法: <left_table_expression>  {cross|outer} apply<right_table_expression> 再让我们了解一下appl ...

  6. selenium_采集药品数据

    Python爬虫视频教程零基础小白到scrapy爬虫高手-轻松入门 https://item.taobao.com/item.htm?spm=a1z38n.10677092.0.0.482434a6E ...

  7. Nginx+Swoole服务器配置

    nginx 配置 server { listen 80; server_name www.swoole.com; root /data/wwwroot/www.swoole.com; location ...

  8. 使用rownum对oracle分页【原】

    以Student表为例进行分页 建表及插入 -- 有表结构如下 create table STUDENT ( sno INTEGER, sname ), sage INTEGER ); -- 插入数据 ...

  9. NTT模板

    NTT(快速数论变换)用到的各种素数及原根: https://blog.csdn.net/hnust_xx/article/details/76572828 NTT多项式乘法模板 #include&l ...

  10. ThinkPHP 3.2 vendor()方法的深入研究及Phpqrcode的正确扩展

    ThinkPHP vendor 方法导入第三方类库 第三方类库 第三方类库指除了 ThinkPHP 框架.应用项目类库之外的其他类库,一般由第三方系统或产品提供,如 Smarty.Zend 等系统的类 ...