X Tutup
Skip to content

Commit c7edbfe

Browse files
author
qiubaiying
committed
add posts
1 parent e48e10e commit c7edbfe

File tree

3 files changed

+303
-1
lines changed

3 files changed

+303
-1
lines changed
Lines changed: 277 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,277 @@
1+
---
2+
layout: post
3+
title: Git指令整理
4+
subtitle: 不适合阅读的整理的一些个人常用的 Git 指令
5+
date: 2017-02-15
6+
author: BY
7+
header-img: img/post-bg-ios9-web.jpg
8+
catalog: true
9+
tags:
10+
- Mac
11+
- 终端
12+
- Git
13+
---
14+
15+
>随便整理,拷贝的一些自用的Git指令
16+
17+
18+
# GitHub创建仓库提示代码
19+
20+
echo "# 项目名" >> README.md
21+
git init
22+
git add README.md
23+
git commit -m "first commit"
24+
git remote add origin git@github.com:qiubaiying/项目名.git
25+
git push -u origin master
26+
27+
若仓库存在直接push
28+
29+
git remote add origin git@github.com:qiubaiying/test.git
30+
git push -u origin master
31+
32+
33+
# 常用操作
34+
35+
#### 创建仓库(初始化)
36+
在当前指定目录下创建
37+
git init
38+
39+
新建一个仓库目录
40+
git init [project-name]
41+
42+
克隆一个远程项目
43+
git clone [url]
44+
45+
#### 添加文件到缓存区
46+
47+
添加所有变化的文件
48+
git add .
49+
50+
添加名称指定文件
51+
git add text.txt
52+
53+
#### 配置
54+
55+
设置提交代码时的用户信息
56+
git config [--global] user.name "[name]"
57+
git config [--global] user.email "[email address]"
58+
59+
60+
#### 提交
61+
提交暂存区到仓库区
62+
git commit -m "msg"
63+
64+
# 提交暂存区的指定文件到仓库区
65+
$ git commit [file1] [file2] ... -m [message]
66+
67+
# 提交工作区自上次commit之后的变化,直接到仓库区
68+
$ git commit -a
69+
70+
# 提交时显示所有diff信息
71+
$ git commit -v
72+
73+
# 使用一次新的commit,替代上一次提交
74+
# 如果代码没有任何新变化,则用来改写上一次commit的提交信息
75+
$ git commit --amend -m [message]
76+
77+
# 重做上一次commit,并包括指定文件的新变化
78+
$ git commit --amend [file1] [file2] ...
79+
80+
#### 分支
81+
82+
# 列出所有本地分支
83+
$ git branch
84+
85+
# 列出所有远程分支
86+
$ git branch -r
87+
88+
# 列出所有本地分支和远程分支
89+
$ git branch -a
90+
91+
# 新建一个分支,但依然停留在当前分支
92+
$ git branch [branch-name]
93+
94+
# 新建一个分支,并切换到该分支
95+
$ git checkout -b [branch]
96+
97+
# 新建一个分支,指向指定commit
98+
$ git branch [branch] [commit]
99+
100+
# 新建一个分支,与指定的远程分支建立追踪关系
101+
$ git branch --track [branch] [remote-branch]
102+
103+
# 切换到指定分支,并更新工作区
104+
$ git checkout [branch-name]
105+
106+
# 切换到上一个分支
107+
$ git checkout -
108+
109+
# 建立追踪关系,在现有分支与指定的远程分支之间
110+
$ git branch --set-upstream [branch] [remote-branch]
111+
112+
# 合并指定分支到当前分支
113+
$ git merge [branch]
114+
115+
# 选择一个commit,合并进当前分支
116+
$ git cherry-pick [commit]
117+
118+
# 删除分支
119+
$ git branch -d [branch-name]
120+
121+
# 删除远程分支
122+
$ git push origin --delete [branch-name]
123+
$ git branch -dr [remote/branch]
124+
125+
#### 标签Tags
126+
127+
添加标签 在当前commit
128+
git tag -a v1.0 -m 'xxx'
129+
130+
添加标签 在指定commit
131+
git tag v1.0 [commit]
132+
133+
查看
134+
git tag
135+
136+
删除
137+
git tag -d V1.0
138+
139+
删除远程tag
140+
git push origin :refs/tags/[tagName]
141+
142+
推送
143+
git push origin --tags
144+
145+
拉取
146+
git fetch origin tag V1.0
147+
148+
新建一个分支,指向某个tag
149+
git checkout -b [branch] [tag]
150+
151+
#### 查看信息
152+
153+
# 显示有变更的文件
154+
$ git status
155+
156+
# 显示当前分支的版本历史
157+
$ git log
158+
159+
# 显示commit历史,以及每次commit发生变更的文件
160+
$ git log --stat
161+
162+
# 搜索提交历史,根据关键词
163+
$ git log -S [keyword]
164+
165+
# 显示某个commit之后的所有变动,每个commit占据一行
166+
$ git log [tag] HEAD --pretty=format:%s
167+
168+
# 显示某个commit之后的所有变动,其"提交说明"必须符合搜索条件
169+
$ git log [tag] HEAD --grep feature
170+
171+
# 显示某个文件的版本历史,包括文件改名
172+
$ git log --follow [file]
173+
$ git whatchanged [file]
174+
175+
# 显示指定文件相关的每一次diff
176+
$ git log -p [file]
177+
178+
# 显示过去5次提交
179+
$ git log -5 --pretty --oneline
180+
181+
# 显示所有提交过的用户,按提交次数排序
182+
$ git shortlog -sn
183+
184+
# 显示指定文件是什么人在什么时间修改过
185+
$ git blame [file]
186+
187+
# 显示暂存区和工作区的差异
188+
$ git diff
189+
190+
# 显示暂存区和上一个commit的差异
191+
$ git diff --cached [file]
192+
193+
# 显示工作区与当前分支最新commit之间的差异
194+
$ git diff HEAD
195+
196+
# 显示两次提交之间的差异
197+
$ git diff [first-branch]...[second-branch]
198+
199+
# 显示今天你写了多少行代码
200+
$ git diff --shortstat "@{0 day ago}"
201+
202+
# 显示某次提交的元数据和内容变化
203+
$ git show [commit]
204+
205+
# 显示某次提交发生变化的文件
206+
$ git show --name-only [commit]
207+
208+
# 显示某次提交时,某个文件的内容
209+
$ git show [commit]:[filename]
210+
211+
# 显示当前分支的最近几次提交
212+
$ git reflog
213+
214+
#### 远程同步
215+
216+
# 下载远程仓库的所有变动
217+
$ git fetch [remote]
218+
219+
# 显示所有远程仓库
220+
$ git remote -v
221+
222+
# 显示某个远程仓库的信息
223+
$ git remote show [remote]
224+
225+
# 增加一个新的远程仓库,并命名
226+
$ git remote add [shortname] [url]
227+
228+
# 取回远程仓库的变化,并与本地分支合并
229+
$ git pull [remote] [branch]
230+
231+
# 上传本地指定分支到远程仓库
232+
$ git push [remote] [branch]
233+
234+
# 强行推送当前分支到远程仓库,即使有冲突
235+
$ git push [remote] --force
236+
237+
# 推送所有分支到远程仓库
238+
$ git push [remote] --all
239+
240+
#### 撤销
241+
242+
# 恢复暂存区的指定文件到工作区
243+
$ git checkout [file]
244+
245+
# 恢复某个commit的指定文件到暂存区和工作区
246+
$ git checkout [commit] [file]
247+
248+
# 恢复暂存区的所有文件到工作区
249+
$ git checkout .
250+
251+
# 重置暂存区的指定文件,与上一次commit保持一致,但工作区不变
252+
$ git reset [file]
253+
254+
# 重置暂存区与工作区,与上一次commit保持一致
255+
$ git reset --hard
256+
257+
# 重置当前分支的指针为指定commit,同时重置暂存区,但工作区不变
258+
$ git reset [commit]
259+
260+
# 重置当前分支的HEAD为指定commit,同时重置暂存区和工作区,与指定commit一致
261+
$ git reset --hard [commit]
262+
263+
# 重置当前HEAD为指定commit,但保持暂存区和工作区不变
264+
$ git reset --keep [commit]
265+
266+
# 新建一个commit,用来撤销指定commit
267+
# 后者的所有变化都将被前者抵消,并且应用到当前分支
268+
$ git revert [commit]
269+
270+
# 暂时将未提交的变化移除,稍后再移入
271+
$ git stash
272+
$ git stash pop
273+
274+
#### 其他
275+
276+
# 生成一个可供发布的压缩包
277+
$ git archives
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
layout: post
3+
title: Mac 文本转音频
4+
subtitle: 在Mac终端上将文本文件转换为音频文件
5+
date: 2017-02-15
6+
author: BY
7+
header-img: img/post-bg-ios9-web.jpg
8+
catalog: true
9+
tags:
10+
- Mac
11+
- 终端
12+
---
13+
14+
# 文本转语音
15+
16+
>分享一条在Mac上将一个文本转换为音频文件的终端命令,个人认为还是蛮实用的。
17+
>
18+
>来自: <http://25.io/toau/>
19+
20+
![](https://ww2.sinaimg.cn/large/006tNbRwgy1fcqwv0i9ovj30du04p74y.jpg)
21+
22+
#### 指令:
23+
24+
cat sample.txt | say -o sample.aiff
25+

_posts/2017-2-9-Mac快速调出终端.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: BY
77
header-img: img/post-bg-re-vs-ng2.jpg
88
catalog: true
99
tags:
10-
- mac
10+
- Mac
1111
- 效率
1212
- 开发技巧
1313
---

0 commit comments

Comments
 (0)
X Tutup