git 入门二 (基础)
1、创建新仓库
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working di
#
# modified: test.txt
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# t.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: h.txt
# new file: test.txt
[master d4a498a] this is test commit
git commit --amend --reset-author
2 files changed, 3 insertions(+)
create mode 100644 t.txt
commit d4a498a197c24421acee5c5ff96cfbc7e5c3be9e
Author: andy<andy@gmail.com>
Date: Sat Mar 8 14:23:37 2014 +0800
this is test commit
commit 80071e48614361dc282473d6482e3faa9fec17d9
Author:andy<andy@gmail.com>
Date: Sat Mar 8 13:35:13 2014 +0800
1st commit
diff --git a/test.txt b/test.txt
index 0147537..f33d264 100644
--- a/test.txt
+++ b/test.txt
@@ -1,3 +1,4 @@
11111111111111
+22222222222222
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working d
#
# modified: test.txt
#
no changes added to commit (use "git add" and/or "git commit -a")
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: test.txt
#
diff --git a/test.txt b/test.txt
index 0147537..f33d264 100644
--- a/test.txt
+++ b/test.txt
@@ -1,3 +1,4 @@
11111111111111
+22222222222222
diff --git a/test.txt b/test.txt
index 0147537..f33d264 100644
--- a/test.txt
+++ b/test.txt
@@ -1,3 +1,4 @@
11111111111111
+22222222222222
[master fc0166f] test git diff
Committer: andy<andy@gmail.com>
git commit --amend --reset-author
1 file changed, 1 insertion(+)
$ git diff --staged
$ git diff head
h.txt test.txt
$ ls
test.txt
$ git diff
diff --git a/h.txt b/h.txt
deleted file mode 100644
index 456f979..0000000
--- a/h.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-welcome to here
-very good
$ git rm h.txt
rm 'h.txt'
diff --git a/h.txt b/h.txt
deleted file mode 100644
index 456f979..0000000
--- a/h.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-welcome to here
-very good
-
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: h.txt
#
HEAD is now at fc0166f test git diff
$ ls
h.txt test.txt
rm 'h.txt'
$ git diff
$ git diff head
diff --git a/h.txt b/h.txt
deleted file mode 100644
index 456f979..0000000
--- a/h.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-welcome to here
-very good
-
$ git diff -cached
error: invalid option: -cached
$ git diff --cached h.txt
diff --git a/h.txt b/h.txt
deleted file mode 100644
index 456f979..0000000
--- a/h.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-welcome to here
-very good
h.txt test.txt
$ git mv h.txt d.txt 结果是等同于,相当于以下三条命令
$ ls
d.txt test.txt
$ mv d.txt to.txt
$ git rm d.txt
rm 'd.txt'
$ git add to.txt
commit fc0166f53a45cfc4c17079e5e3454fb7e3136cb6
Author: andy<andy@gmail.com>
Date: Sat Mar 8 15:52:10 2014 +0800
test git diff
commit d6eab3a38aee0b25ac395899c82edd48723a2ea9
Date: Sat Mar 8 15:36:53 2014 +0800
enforce commit'
commit 85ec024140442df6db8625a07c2ee7369cceb704
Date: Sat Mar 8 15:35:44 2014 +0800
com 3
fc0166f - yyf, 48 minutes ago : test git diff
d6eab3a - yyf, 63 minutes ago : enforce commit'
85ec024 - yyf, 65 minutes ago : com 3
d4a498a - unknown, 2 hours ago : this is test commit
80071e4 - unknown, 3 hours ago : 1st commit
%H 提交对象(commit)的完整哈希字串
%h 提交对象的简短哈希字串
%T 树对象(tree)的完整哈希字串
%t 树对象的简短哈希字串
%P 父对象(parent)的完整哈希字串
%p 父对象的简短哈希字串
%an 作者(author)的名字
%ae 作者的电子邮件地址
%ad 作者修订日期(可以用 -date= 选项定制格式)
%ar 作者修订日期,按多久以前的方式显示
%cn 提交者(committer)的名字
%ce 提交者的电子邮件地址
%cd 提交日期
%cr 提交日期,按多久以前的方式显示
%s 提交说明
* 78d907a dev branch commit
* fc0166f test git diff
* d6eab3a enforce commit'
* 85ec024 com 3
* d4a498a this is test commit
* 80071e4 1st commit
-p 按补丁格式显示每个更新之间的差异。
--stat 显示每次更新的文件修改统计信息。
--shortstat 只显示 --stat 中最后的行数修改添加移除统计。
--name-only 仅在提交信息后显示已修改的文件清单。
--name-status 显示新增、修改、删除的文件清单。
--abbrev-commit 仅显示 SHA-1 的前几个字符,而非所有的 40 个字符。
--relative-date 使用较短的相对时间显示(比如,“2 weeks ago”)。
--graph 显示 ASCII 图形表示的分支合并历史。
--pretty 使用其他格式显示历史提交信息。可用的选项包括 oneline,short,full,fuller 和 format(后跟指定格式)
[master c660522] modify commit
c660522 modify commit
fc0166f test git diff
d6eab3a enforce commit'
85ec024 com 3
d4a498a this is test commit
80071e4 1st commit
git 入门二 (基础)的更多相关文章
- GIT之二 基础篇(1)
GIT基础 取得项目的 Git 仓库 有两种取得 Git 项目仓库的方法.第一种是在现存的目录下,通过导入所有文件来创建新的 Git 仓库.第二种是从已有的 Git 仓库克隆出一个新的镜像仓库来. 在 ...
- GIT之二 基础篇(2)
远程仓库的使用 要参与任何一个 Git 项目的协作,必须要了解该如何管理远程仓库.远程仓库是指托管在网络上的项目仓库,可能会有好多个,其中有些你只能读,另外有些可以写.同他人协作开发某个项目时,需要管 ...
- git入门学习(二):新建分支/上传代码/删除分支
一.git新建分支,上传代码到新的不同分支 我要实现的效果,即是多个内容的平行分支:这样做的主要目的是方便统一管理属于同一个内容的不同的项目,互不干扰.如图所示: 前提是我的github上已经有we ...
- Swift语法基础入门二(数组, 字典, 字符串)
Swift语法基础入门二(数组, 字典, 字符串) 数组(有序数据的集) *格式 : [] / Int / Array() let 不可变数组 var 可变数组 注意: 不需要改变集合的时候创建不可变 ...
- Qt入门之基础篇 ( 二 ) :Qt项目建立、编译、运行和发布过程解析
转载请注明出处:CN_Simo. 题解: 本篇内容主讲Qt应用从创建到发布的整个过程,旨在帮助读者能够快速走进Qt的世界. 本来计划是讲解Qt源码静态编译,如此的话读者可能并不能清楚地知道为何要静态编 ...
- IM开发者的零基础通信技术入门(二):通信交换技术的百年发展史(下)
1.系列文章引言 1.1 适合谁来阅读? 本系列文章尽量使用最浅显易懂的文字.图片来组织内容,力求通信技术零基础的人群也能看懂.但个人建议,至少稍微了解过网络通信方面的知识后再看,会更有收获.如果您大 ...
- Git入门基础详情教程
前言 写了一篇文章<一篇文章了解Github和Git教程>还觉得不错,继续写了<为了Github默默付出,我想了解你>,那么继续写Git 基础知识. Git 官网:https: ...
- 2.Python爬虫入门二之爬虫基础了解
1.什么是爬虫 爬虫,即网络爬虫,大家可以理解为在网络上爬行的一直蜘蛛,互联网就比作一张大网,而爬虫便是在这张网上爬来爬去的蜘蛛咯,如果它遇到资源,那么它就会抓取下来.想抓取什么?这个由你来控制它咯. ...
- Python爬虫入门二之爬虫基础了解
1.什么是爬虫 爬虫,即网络爬虫,大家可以理解为在网络上爬行的一直蜘蛛,互联网就比作一张大网,而爬虫便是在这张网上爬来爬去的蜘蛛咯,如果它遇到资源,那么它就会抓取下来.想抓取什么?这个由你来控制它咯. ...
随机推荐
- 单条sql性能分析与优化
性能分析 1. explain 查看sql执行计划,得出索引使用情况等信息 2. show profiling 查看sql所有执行步骤以及用时,使用步骤如下 1)开启性能剖析 mysql> se ...
- 一致性hash-java实现treemap版
把不同号段的数据储存在不同的机器上,以用来分散压力.假如我们有一百万个QQ号,十台机器,,如何划分呢? 最简单粗暴的方法是用QQ号直接对10求余,结果为0-9 分别对应上面的十台机器.比如QQ号为 2 ...
- windows下搭建svn服务器
转自:http://www.cnblogs.com/cloud2rain/archive/2013/04/11/3015080.html 这篇文档非常好,转来学习,有一点就是把subversion创建 ...
- form的action属性作用
一.action=""和action="#".没有action属性的作用相同,都是提交到当前页面(也就是document.location.href) 二.ac ...
- apache 限制某些目录不能访问通过rewrite实现
通过deny allow访问控制肯定是可以实现的单个目录,但是这个必须指定准确的目录,如果有很多个目录,但是都包含某个名字,比如bbs.1.com/1/tmp/123.htmlbbs.1.com/2/ ...
- ElasticSearch 组合过滤器
1.布尔过滤器 前篇文章中(term精确查找)的两个例子都是单个过滤器(filter)的使用方式. 在实际应用中,我们很有可能会过滤多个值或字段.比方说,怎样用 Elasticsearch 来表达下面 ...
- Mysql_SQL_常用知识点&实践
1.Mysql中类似于nvl()函数的ifnull()函数 ) FROM Table 2.添加某个字段(指定字段column的位置) ----------添加字段zoneId ) NOT NULL A ...
- 修改MySQL数据库存储位置datadir
2017-04-14 1.找到mysql安装目录,默认是C:/ProgramData/MySQL/MySQL Server 5.1,找到my.ini.如果这个文件没有,自己建一个my.ini. 2.假 ...
- 2016.6.29 tomcat卸载后在安装出现错误:failed to install tomcat7 service
错误如下: 错误原因: 直接删除了安装目录,而不是点击卸载(包含删除服务) 因此在此安装时,显示安装服务失败(因为已经存在了) 解决办法: (1)手动删除注册表 regedit.exe,找到H ...
- Centos 7 搭建OpenStack 私有云——(1)基础环境配置
1.简介: OpenStack是一个由NASA(美国国家航空航天局)和Rackspace合作研发并发起的,以Apache许可证授权的自由软件和开放源代码项目. OpenStack是一个开源的云计算管理 ...