一、仓库管理

➜ 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. 利用NEST2.0 在C#中操作Elasticsearch

    前言:本文主要演示了如何通过c#来操作elasticsearch,分两个方面来演示: 索引数据 搜索数据 Note: 注意我索引数据和搜索数据是两个不同的例子,没有前后依赖关系 准备工作:需要在vis ...

  2. [NOI2009]二叉查找树

    题目大意: 给定一棵严格的treap,父亲节点的优先级必然小于儿子节点的.权值按照二叉树的定义,左儿子小于父亲小于右儿子. 深度从1开始定义,每个点除优先级.数值之外,还有一个访问频度. 访问频度所产 ...

  3. display position 和float的作用和关系

    1.传统布局由这三者构成. 2.position设为absolute,那么display一定是block,因此对于span来说,就可以设置高和宽了. 3.position为relative ,那么fl ...

  4. UIManager的字体颜色参数对照表

    FileChooser.fileTypeHeaderTextTextArea.margincom.sun.java.swing.plaf.windows.WindowsSplitPaneUIcom.s ...

  5. Flash与JavaScript互动

    最近做的一个项目需要用javascript来实现自动复制文本到剪切板,但测试时发现只有ie6.0支持. 到百度搜索后才发现,原来ie7.0.firefox是不支持这样的操作的,随后又搜索了一下,找到一 ...

  6. (大数 string) Integer Inquiry hdu1047

    Integer Inquiry Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) ...

  7. 关于TCP连接状态的解释

    TCP各个状态主要存在于三次握手和四次挥手的过程 1.TCP建立连接时的三次握手: 服务端应用监听端口处于LISTEN状态,等待建立连接. 第一次握手:客户端发送SYN=一个随机数,然后进入SYN_S ...

  8. prometheus + grafana部署RabbitMQ监控

    prometheus + grafana部署RabbitMQ监控 1.grafana导入dashboards https://grafana.com/dashboards/2121   2.expor ...

  9. Thread的setDaemon(true)方法

    定义:守护线程--也称“服务线程”,在没有用户线程可服务时会自动离开.优先级:守护线程的优先级比较低,用于为系统中的其它对象和线程提供服务. 设置:通过setDaemon(true)来设置线程为“守护 ...

  10. <algorithm>里的sort函数对结构体排序

    题目描述 每天第一个到机房的人要把门打开,最后一个离开的人要把门关好.现有一堆杂乱的机房签到.签离记录,请根据记录找出当天开门和关门的人. 输入描述: 每天的记录在第一行给出记录的条目数M (M &g ...