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.什么是爬虫 爬虫,即网络爬虫,大家可以理解为在网络上爬行的一直蜘蛛,互联网就比作一张大网,而爬虫便是在这张网上爬来爬去的蜘蛛咯,如果它遇到资源,那么它就会抓取下来.想抓取什么?这个由你来控制它咯. ...
随机推荐
- php程序无法使用localhost连接数据库解决方法(linux)
php程序无法使用localhost连接数据库解决方法(linux) 出现这种情况是因为PHP无法正确获取mysql.sock 在php.ini文件中指定即可解决问题. 修改如下: 找到 mysql. ...
- Jenkins配置Publish Junit test result report(转)
参考这篇文章:http://www.yiibai.com/jenkins/jenkins_unit_testing.html 插件:JUnit Plugin
- Delphi CRC算法crcexecute
function crcexecute(pcstring : string) : string ; forward; var gnkey : integer; gnsalt : integer; ...
- Flex 布局学习笔记
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- AutoCAD中导入图片
导入图片涉及到两个关键的问题:如何将图片放置到指定的位置或范围内:如何修改图片的路径类型,如相对路径.绝对路径. 本文以AutoCAD 2018位演示截图来源. 1 将图片放置到指定的位置或范围内 ( ...
- Vue的常用指令v-if, v-for, v-show,v-else, v-bind, v-on
Vue.js的指令是以v-开头的,它们作用于HTML元素,指令提供了一些特殊的特性,将指令绑定在元素上时,指令会为绑定的目标元素添加一些特殊的行为,我们可以将指令看作特殊的HTML特性(attribu ...
- 关于国内外CV领域牛人的博客链接 .
此文为转载文章,尊重知识产权http://blog.csdn.net/carson2005/article/details/6601109此为原文链接,感谢作者! 以下链接是关于计算机视觉(Compu ...
- Hive设置参数的三种方法
Hive提供三种可以改变环境变量的方法,分别是:(1).修改${HIVE_HOME}/conf/hive-site.xml配置文件:(2).命令行参数:(3).在已经进入cli时进行参数声明.下面分别 ...
- .Net程序测试阿里云OSS开放存储服务
阿里云官网有提供OSS相关的操作API文档和.Net程序的 SDK,也可以在这里下载OSS相关文件 但是API文档里面的都是通过http请求和响应的消息来描述如何操作OSS的 而一般在程序中需要的是O ...
- Java之Jackson框架
在Jackson框架中,提供了三种方式用来处理JSON数据: 流式API 在该方式下,使用JsonParser读取JSON数据,使用JsonGenerator写JSON数据.这种方式性能最佳(最低开销 ...