-
Notifications
You must be signed in to change notification settings - Fork 0
/
git01.html
403 lines (371 loc) · 34.9 KB
/
git01.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
<!DOCTYPE html><html lang="zh-CN" data-theme="dark"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>个人使用过的git命令记录 | 惜别的秘密基地</title><meta name="author" content="SekiBetu"><meta name="copyright" content="SekiBetu"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#0d0d0d"><meta name="description" content="经常忘记 git 命令,所以开始记录遇到过的命令,方便自己查阅 git 是 snapshot 式保存手段(每一次 commit 都是完整的 snapshot),但又偏向于增量式保存,举例: 现有以下两个文件已成为第一次 commit A.txt B.txt 那么 git 会将其分为若干个 git 对象,并将这些对象进行切割后压缩保存(delta), 当我修改了 A.txt,再次 commit 时">
<meta property="og:type" content="article">
<meta property="og:title" content="个人使用过的git命令记录">
<meta property="og:url" content="https://sekibetu.com/git01.html">
<meta property="og:site_name" content="惜别的秘密基地">
<meta property="og:description" content="经常忘记 git 命令,所以开始记录遇到过的命令,方便自己查阅 git 是 snapshot 式保存手段(每一次 commit 都是完整的 snapshot),但又偏向于增量式保存,举例: 现有以下两个文件已成为第一次 commit A.txt B.txt 那么 git 会将其分为若干个 git 对象,并将这些对象进行切割后压缩保存(delta), 当我修改了 A.txt,再次 commit 时">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://sekibetu.com/img/67861832_p0.jpg">
<meta property="article:published_time" content="2020-11-22T21:06:42.000Z">
<meta property="article:modified_time" content="2022-06-17T13:31:34.000Z">
<meta property="article:author" content="SekiBetu">
<meta property="article:tag" content="git">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://sekibetu.com/img/67861832_p0.jpg"><link rel="shortcut icon" href="/favicon.ico"><link rel="canonical" href="https://sekibetu.com/git01.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css?v=5.1.0"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/[email protected]/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/snackbar.min.css" media="print" onload="this.media='all'"><script>
(() => {
const saveToLocal = {
set: (key, value, ttl) => {
if (!ttl) return
const expiry = Date.now() + ttl * 86400000
localStorage.setItem(key, JSON.stringify({ value, expiry }))
},
get: key => {
const itemStr = localStorage.getItem(key)
if (!itemStr) return undefined
const { value, expiry } = JSON.parse(itemStr)
if (Date.now() > expiry) {
localStorage.removeItem(key)
return undefined
}
return value
}
}
window.btf = {
saveToLocal,
getScript: (url, attr = {}) => new Promise((resolve, reject) => {
const script = document.createElement('script')
script.src = url
script.async = true
Object.entries(attr).forEach(([key, val]) => script.setAttribute(key, val))
script.onload = script.onreadystatechange = () => {
if (!script.readyState || /loaded|complete/.test(script.readyState)) resolve()
}
script.onerror = reject
document.head.appendChild(script)
}),
getCSS: (url, id) => new Promise((resolve, reject) => {
const link = document.createElement('link')
link.rel = 'stylesheet'
link.href = url
if (id) link.id = id
link.onload = link.onreadystatechange = () => {
if (!link.readyState || /loaded|complete/.test(link.readyState)) resolve()
}
link.onerror = reject
document.head.appendChild(link)
}),
addGlobalFn: (key, fn, name = false, parent = window) => {
if (!true && key.startsWith('pjax')) return
const globalFn = parent.globalFn || {}
globalFn[key] = globalFn[key] || {}
if (name && globalFn[key][name]) return
globalFn[key][name || Object.keys(globalFn[key]).length] = fn
parent.globalFn = globalFn
}
}
const activateDarkMode = () => {
document.documentElement.setAttribute('data-theme', 'dark')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
}
}
const activateLightMode = () => {
document.documentElement.setAttribute('data-theme', 'light')
if (document.querySelector('meta[name="theme-color"]') !== null) {
document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
}
}
btf.activateDarkMode = activateDarkMode
btf.activateLightMode = activateLightMode
const theme = saveToLocal.get('theme')
theme === 'dark' ? activateDarkMode() : theme === 'light' ? activateLightMode() : null
const asideStatus = saveToLocal.get('aside-status')
if (asideStatus !== undefined) {
document.documentElement.classList.toggle('hide-aside', asideStatus === 'hide')
}
const detectApple = () => {
if (/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)) {
document.documentElement.classList.add('apple')
}
}
detectApple()
})()
</script><link rel="stylesheet" href="/font/JetBrainsMono-Regular.ttf" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
root: '/',
algolia: undefined,
localSearch: undefined,
translate: undefined,
noticeOutdate: {"limitDay":365,"position":"top","messagePrev":"本文创建在","messageNext":"天前,其中的内容有可能已经过时"},
highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false,"highlightFullpage":false,"highlightMacStyle":true},
copy: {
success: '复制成功',
error: '复制失败',
noSupport: '浏览器不支持'
},
relativeDate: {
homepage: false,
post: false
},
runtime: '',
dateSuffix: {
just: '刚刚',
min: '分钟前',
hour: '小时前',
day: '天前',
month: '个月前'
},
copyright: undefined,
lightbox: 'null',
Snackbar: {"chs_to_cht":"已切换为繁体中文","cht_to_chs":"已切换为简体中文","day_to_night":"已切换为深色模式","night_to_day":"已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
infinitegrid: {
js: 'https://cdn.jsdelivr.net/npm/@egjs/[email protected]/dist/infinitegrid.min.js',
buttonText: '加载更多'
},
isPhotoFigcaption: false,
islazyload: false,
isAnchor: false,
percent: {
toc: true,
rightside: true,
},
autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: '个人使用过的git命令记录',
isPost: true,
isHome: false,
isHighlightShrink: false,
isToc: true,
postUpdate: '2022-06-17 21:31:34'
}</script><meta name="generator" content="Hexo 7.3.0"><link rel="alternate" href="/atom.xml" title="惜别的秘密基地" type="application/atom+xml">
</head><body><div id="web_bg" style="background-image: url(/img/48036836_p0.jpg);"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img text-center"><img src="/img/SekiBetu.png" onerror="onerror=null;src='/img/Starfetcher.jpg'" alt="avatar"/></div><div class="site-data text-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">18</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">27</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(/img/67861832_p0.jpg);"><nav id="nav"><span id="blog-info"><a class="nav-site-title" href="/"><span class="site-name">惜别的秘密基地</span></a><a class="nav-page-title" href="/"><span class="site-name">个人使用过的git命令记录</span></a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 首页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 时间轴</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></div></div><div id="toggle-menu"><span class="site-page"><i class="fas fa-bars fa-fw"></i></span></div></div></nav><div id="post-info"><h1 class="post-title">个人使用过的git命令记录</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2020-11-22T21:06:42.000Z" title="发表于 2020-11-23 05:06:42">2020-11-23</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2022-06-17T13:31:34.000Z" title="更新于 2022-06-17 21:31:34">2022-06-17</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">总字数:</span><span class="word-count">1.7k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>6分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title=""><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">浏览量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h3 id="经常忘记-git-命令,所以开始记录遇到过的命令,方便自己查阅">经常忘记 git 命令,所以开始记录遇到过的命令,方便自己查阅</h3>
<blockquote>
<p>git 是 snapshot 式保存手段(每一次 commit 都是完整的 snapshot),但又偏向于增量式保存,举例:<br>
现有以下两个文件已成为第一次 commit<br>
A.txt<br>
B.txt<br>
那么 git 会将其分为若干个 git 对象,并将这些对象进行切割后压缩保存(delta),<br>
当我修改了 A.txt,再次 commit 时,<br>
git 不会存储改动后的整个 A.txt,<br>
而是存储一个指向 B.txt 的指针加上 A.txt 改动的部分,这些就是新增的 git 对象,git 接着将其按一定规则切割后压缩保存(delta)<br>
总的来说,git 对象偏向于内容,而 delta 偏向于二进制分段压缩包,</p>
<p>每次 commit 的 delta 部分就像是彩虹六号 Y5S4 赛季这次更新的时候,游戏本体就 70G 左右,补丁却需要下载 60G,<br>
因为彩虹六号把材质文件都封装进了 delta 文件,这类文件特别大,根目录下最大的单个材质包文件可达 28G,即使是改动了其中的一张图片,也需要整个重新下载,而 git 的包切得很小,可重复利用的 delta 文件多,每次 commit 就能省下不少空间</p>
<p>Total A (delta B), reused C (delta D) 中的 A、B、C、D 意思分别为</p>
<p>A、本次打包总计有 A 个 git 对象</p>
<p>[每个文件的每一次改动都会创造出一个新的内容级别的对象],</p>
<p>B、从第一次 commit 以来的二进制分段压缩包级别的增量改动包 B 个</p>
<p>[与内容级别的对象不同点是将内容级别的对象按一定规则切割成分段压缩包]</p>
<p>C、有 C 个可重复使用的 git 对象</p>
<p>D、有 D 个二进制分段压缩包级别的增量改动包可重复使用而不需要重新打包</p>
</blockquote>
<p><code>git config --global user.name "xxx"</code> # 配置用户名<br>
<code>git config --global user.email "[email protected]"</code> # 配置邮箱<br>
<code>git config --global color.ui true</code> # git 命令自动着色<br>
<code>git config --global color.status auto</code><br>
<code>git config --global color.diff auto</code><br>
<code>git config --global color.branch auto</code><br>
<code>git config --global color.interactive auto</code></p>
<p><code>git config --global http.https://github.com.proxy socks5://127.0.0.1:2080</code> # 设置代理</p>
<p><code>git config --global --unset http.proxy</code> # 取消代理<br>
<code>git clone XXX.git</code> # clone 远程仓库<br>
<code>git status</code> # 查看当前改动<br>
<code>git add A</code> # 提交 A 文件至 index<br>
<code>git add .</code> # 提交所有文件更改<br>
<code>git commit -m 'xxx'</code> # 提交<br>
<code>git commit --amend -m 'xxx'</code> # 合并上一次提交(用于反复修改)<br>
<code>git commit -am 'xxx'</code> # 将 add 和 commit 合为一步<br>
<code>git rm xxx</code> # 删除 index 中的文件<br>
<code>git rm -r *</code> # 递归删除<br>
<code>git log -n</code> # 显示 n 行提交日志<br>
<code>git log --stat</code> # 显示提交日志及相关变动文件<br>
<code>git show dfb02e6e4f2f7b573337763e5c0013802e392818</code> # 显示某个提交的详细内容<br>
<code>git show dfb02</code> # 同上,可只用 commit ID 的前几位<br>
<code>git show HEAD</code> # 显示 HEAD 提交日志<br>
<code>git show HEAD^</code> # 显示 HEAD 的父(上一个版本)的提交日志 ^^为上两个版本 ^5 为上 5 个版本</p>
<p><code>git show main@{yesterday}</code> # 显示 main 分支昨天的状态</p>
<p><code>git tag</code> # 显示已存在的 tag<br>
<code>git tag -a v2.0 -m 'xxx'</code> # 增加 v2.0 的 tag<br>
<code>git show v2.0</code> # 显示 v2.0 的日志及详细内容<br>
<code>git log v2.0</code> # 显示 v2.0 的日志<br>
<code>git diff</code> # 显示所有未添加至 index 的变更<br>
<code>git diff --cached</code> # 显示所有已添加 index 但还未 commit 的变更<br>
<code>git diff HEAD^</code> # 比较与上一个版本的差异<br>
<code>git diff HEAD -- ./lib</code> # 比较与 HEAD 版本 lib 目录的差异<br>
<code>git diff origin/main main</code> # 比较远程分支 main 上有本地分支 main 上没有的<br>
<code>git diff origin/main main --stat</code> # 只显示差异的文件,不显示具体内容<br>
<code>git remote add origin XXX.git</code> # 增加远程定义(用于 push/pull/fetch)<br>
<code>git branch</code> # 显示本地分支<br>
<code>git branch --contains 50089</code> # 显示包含提交 50089 的分支<br>
<code>git branch -a</code> # 显示所有分支<br>
<code>git branch -r</code> # 显示所有原创分支<br>
<code>git branch --merged</code> # 显示所有已合并到当前分支的分支<br>
<code>git branch --no-merged</code> # 显示所有未合并到当前分支的分支<br>
<code>git branch -m main main_copy</code> # 本地分支改名<br>
<code>git checkout -b main_copy</code> # 从当前分支创建新分支 main_copy 并切换<br>
<code>git checkout -b main main_copy</code> # 上面的完整版<br>
<code>git checkout branch</code> # 切换已存在的 branch 分支<br>
<code>git checkout --track branch</code> # 切换远程分支 branch 并创建本地跟踪分支<br>
<code>git checkout v2.0</code> # 切换版本 v2.0<br>
<code>git checkout -b dev origin/dev</code> # 从远程分支 dev 创建新本地分支 dev 并切换<br>
<code>git checkout -- README</code> # 检出 head 版本的 README 文件(可用于修改错误回退)<br>
<code>git merge origin/main</code> # 合并远程 main 分支至当前分支<br>
<code>git cherry-pick ff44785404a8e</code> # 合并提交 ff44785404a8e 的修改<br>
<code>git push origin dev:main</code> # 将本地的 dev 分支 push 到远程的 main 分支</p>
<p><code>git push origin --delete branch</code> # 删除远程仓库的 branch 分支</p>
<p><code>git push origin :branch</code> # 同上<br>
<code>git push --tags</code> # 把所有 tag 推送到远程仓库<br>
<code>git fetch</code> # 获取所有远程分支(不更新本地分支,另需 merge)<br>
<code>git fetch --prune</code> # 获取所有原创分支并清除服务器上已删掉的分支</p>
<p><code>git --set-upstream-to=origin/main main</code> # 将 main 分支的远程分支设为 origin/main</p>
<p><code>git pull --rebase origin main</code> # rebase 式 pull 远程 origin 代码到本地 main 分支(需要与上一步结合确定 pull 哪个分支)</p>
<p><code>git pull origin main</code> # 获取远程 origin 的分支并 merge 到本地 main 分支<br>
<code>git mv README README2</code> # 重命名文件 README 为 README2<br>
<code>git reset --hard HEAD</code> # 将当前版本重置为 HEAD(通常用于 merge 失败回退)<br>
<code>git rebase main patch</code> # 换底,将 patch 分支的基准换成 main 分支<br>
<code>git branch -d branch</code> # 删除本地分支 branch(本分支修改已合并到其他分支)<br>
<code>git branch -D branch</code> # 强制删除本地分支 branch<br>
<code>git ls-files</code> # 列出 git index 包含的文件<br>
<code>git show-branch</code> # 图示当前分支历史<br>
<code>git show-branch --all</code> # 图示所有分支历史<br>
<code>git whatchanged</code> # 显示提交历史对应的文件修改<br>
<code>git revert dfb02e6e4f2f7b573337763e5c0013802e392818</code> # 撤销提交 dfb02e6e4f2f7b573337763e5c0013802e392818<br>
<code>git ls-tree HEAD</code> # 内部命令:显示某个 git 对象<br>
<code>git rev-parse v2.0</code> # 内部命令:显示某个 ref 对于的 SHA1 HASH<br>
<code>git reflog</code> # 显示所有提交,包括孤立节点</p>
<p><code>git log --pretty=format:'%h %s' --graph</code> # 图示提交日志<br>
<code>git stash</code> # 暂存当前修改,将所有文件置为 HEAD 状态<br>
<code>git stash list</code> # 查看所有暂存<br>
<code>git stash show -p stash@{0}</code> # 参考第一次暂存<br>
<code>git stash apply stash@{0}</code> # 应用第一次暂存<br>
<code>git grep "delete from"</code> # 文件中搜索文本“delete from”<br>
<code>git gc</code> # 清理不必要的文件并优化本地存储库</p>
<p><code>git rm -r -f --cached .</code> # 删除缓存区而不删除本地文件(可以配合.gitignore 使用)</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://sekibetu.com">SekiBetu</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://sekibetu.com/git01.html">https://sekibetu.com/git01.html</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来源 <a href="https://sekibetu.com" target="_blank">惜别的秘密基地</a>!</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/git/">git</a></div><div class="post-share"><div class="social-share" data-image="/img/67861832_p0.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/[email protected]/sharejs/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><a class="pagination-related" href="/salt01.html" title="什么是Hash算法加盐"><img class="cover" src="/img/67861832_p0.jpg" onerror="onerror=null;src='/img/Starfetcher.jpg'" alt="cover of previous post"><div class="info"><div class="info-1"><div class="info-item-1">上一篇</div><div class="info-item-2">什么是Hash算法加盐</div></div><div class="info-2"><div class="info-item-1">以下是一个典型的 Hash 算法加盐思路: 1Hash算法(Hash算法(密码)+盐) 1、使用慢 Hash 算法可以拖延破解时间【重要】 2、使用和 Hash 函数输出的字符串等长的盐值,比如 SHA256 算法的输出是 256bits(32 bytes),那么盐值也至少应该是 32 个随机字节【重要】 3、使用随机盐还是固定盐,取决于程序是否被泄露, 一般认为,数据库是第一个被泄露的,那么随机盐是直接被拿走了,而嵌入于程序中的固定盐是安全的; 但是,能入侵到数据库的黑客一般程序也顺手可以拿走了,所以固定盐反而降低了后续彩虹表的建立时间, 所以使用随机盐虽然免不了随机盐、密码和算法一起被泄露,但能增加彩虹表攻击的成本(每一个盐都需要建立一个彩虹表,能增加一丢丢破解时间) 我认为默认使用随机盐是好事,但是有些特殊情况下使用固定盐反而能取胜 </div></div></div></a><a class="pagination-related" href="/docker01.html" title="Docker笔记(自用)"><img class="cover" src="/img/67861832_p0.jpg" onerror="onerror=null;src='/img/Starfetcher.jpg'" alt="cover of next post"><div class="info text-right"><div class="info-1"><div class="info-item-1">下一篇</div><div class="info-item-2">Docker笔记(自用)</div></div><div class="info-2"><div class="info-item-1">随手记点笔记,不全,自用 Docker 基础命令 服务相关命令 systemctl start docker systemctl stop docker systemctl restart docker systemctl status docker systemctl enable docker 为 docker 服务设置开机自启 镜像相关命令 docker images 查看本地镜像 docker search 镜像名称 搜索镜像 docker pull 镜像名称:版本号 从 docker 仓库拉取某版本的镜像到本地 docker build 创建 dockerfile 镜像 容器相关命令 docker ps -a 查看所有本地容器 举例:docker run -it --name=cl centos:7 /bin/bash 创建一个名为 cl 的 centos7 的容器并以 bash 这个 shell 进入交互式界面 exit 可以退出容器但会使带-t 参数的交互式容器停止,所以要避免-t 参数的使用,但是可以使用^p^q...</div></div></div></a></nav><hr class="custom-hr"/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div><div class="comment-switch"><span class="first-comment">Utterances</span><span id="switch-btn"></span><span class="second-comment">Giscus</span></div></div><div class="comment-wrap"><div><div id="utterances-wrap"></div></div><div><div id="giscus-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info text-center"><div class="avatar-img"><img src="/img/SekiBetu.png" onerror="this.onerror=null;this.src='/img/Starfetcher.jpg'" alt="avatar"/></div><div class="author-info-name">SekiBetu</div><div class="author-info-description">记录与分享各种东西</div><div class="site-data"><a href="/archives/"><div class="headline">文章</div><div class="length-num">18</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">27</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">0</div></a></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/SekiBetu"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons"><a class="social-icon" href="https://twitter.com/_SekiBetu_" target="_blank" title="Twitter"><i class="fab fa-twitter"></i></a><a class="social-icon" href="mailto:[email protected]" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://sekibetu.com/atom.xml" target="_blank" title="RSS"><i class="fas fa-rss"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content is-expand"><ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%BB%8F%E5%B8%B8%E5%BF%98%E8%AE%B0-git-%E5%91%BD%E4%BB%A4%EF%BC%8C%E6%89%80%E4%BB%A5%E5%BC%80%E5%A7%8B%E8%AE%B0%E5%BD%95%E9%81%87%E5%88%B0%E8%BF%87%E7%9A%84%E5%91%BD%E4%BB%A4%EF%BC%8C%E6%96%B9%E4%BE%BF%E8%87%AA%E5%B7%B1%E6%9F%A5%E9%98%85"><span class="toc-number">1.</span> <span class="toc-text">经常忘记 git 命令,所以开始记录遇到过的命令,方便自己查阅</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/linus01.html" title="对Linux社区封禁俄罗斯开发者且linus本人支持这一行为的评价">对Linux社区封禁俄罗斯开发者且linus本人支持这一行为的评价</a><time datetime="2024-10-24T13:54:15.000Z" title="发表于 2024-10-24 21:54:15">2024-10-24</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/followis.html" title="三分钟,让Follow认证我的Hexo博客订阅源">三分钟,让Follow认证我的Hexo博客订阅源</a><time datetime="2024-10-14T12:04:50.000Z" title="发表于 2024-10-14 20:04:50">2024-10-14</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/rss01.html" title="给 Hexo 博客加上 PubSubHubbub 协议实现 RSS 实时推送">给 Hexo 博客加上 PubSubHubbub 协议实现 RSS 实时推送</a><time datetime="2022-06-29T21:55:05.000Z" title="发表于 2022-06-30 05:55:05">2022-06-30</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/sniff01.html" title="抓取安卓端FGO游戏数据并导入素材规划软件Chaldea教程(需解锁BootLoader)">抓取安卓端FGO游戏数据并导入素材规划软件Chaldea教程(需解锁BootLoader)</a><time datetime="2022-06-08T11:58:22.000Z" title="发表于 2022-06-08 19:58:22">2022-06-08</time></div></div><div class="aside-list-item no-cover"><div class="content"><a class="title" href="/ssh01.html" title="SSH客户端简单对比">SSH客户端简单对比</a><time datetime="2022-06-07T14:37:06.000Z" title="发表于 2022-06-07 22:37:06">2022-06-07</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url(/img/67861832_p0.jpg);"><div id="footer-wrap"><div class="copyright">©2020 - 2024 By SekiBetu</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="https://icp.gov.moe/?keyword=20213842" target="_blank">萌ICP备20213842号</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="日间和夜间模式切换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="前往评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js?v=5.1.0"></script><script src="/js/main.js?v=5.1.0"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/snackbar.min.js"></script><div class="js-pjax"><script>(() => {
const getUtterancesTheme = theme => theme === 'dark' ? 'github-dark' : 'github-light'
const loadUtterances = () => {
const config = Object.assign({
id: 'utterances_comment',
src: 'https://utteranc.es/client.js',
repo: 'SekiBetu/BlogComments',
'issue-term': 'title',
theme: getUtterancesTheme(document.documentElement.getAttribute('data-theme')),
crossorigin: 'anonymous',
async: true
},null)
const ele = document.createElement('script')
for (let key in config) {
ele.setAttribute(key, config[key])
}
document.getElementById('utterances-wrap').appendChild(ele)
}
const changeUtterancesTheme = theme => {
const iframe = document.querySelector('#utterances-wrap iframe')
if (iframe) {
const message = {
type: 'set-theme',
theme: getUtterancesTheme(theme)
};
iframe.contentWindow.postMessage(message, 'https://utteranc.es')
}
}
btf.addGlobalFn('themeChange', changeUtterancesTheme, 'utterances')
if ('Utterances' === 'Utterances' || !false) {
if (false) btf.loadComment(document.getElementById('utterances-wrap'), loadUtterances)
else loadUtterances()
} else {
window.loadOtherComment = loadUtterances
}
})()</script><script>(()=>{
const getGiscusTheme = theme => theme === 'dark' ? 'dark' : 'light'
const loadGiscus = () => {
const config = Object.assign({
src: 'https://giscus.app/client.js',
'data-repo': 'SekiBetu/BlogComments',
'data-repo-id': 'MDEwOlJlcG9zaXRvcnk0MDU2MzIxMzY=',
'data-category-id': 'DIC_kwDOGC10iM4CPwsn',
'data-mapping': 'pathname',
'data-theme': getGiscusTheme(document.documentElement.getAttribute('data-theme')),
'data-reactions-enabled': '1',
crossorigin: 'anonymous',
async: true
},null)
const ele = document.createElement('script')
for (let key in config) {
ele.setAttribute(key, config[key])
}
document.getElementById('giscus-wrap').appendChild(ele)
}
const changeGiscusTheme = theme => {
const iframe = document.querySelector('#giscus-wrap iframe')
if (iframe) {
const message = {
giscus: {
setConfig: {
theme: getGiscusTheme(theme)
}
}
}
iframe.contentWindow.postMessage(message, 'https://giscus.app')
}
}
btf.addGlobalFn('themeChange', changeGiscusTheme, 'giscus')
if ('Utterances' === 'Giscus' || !false) {
if (false) btf.loadComment(document.getElementById('giscus-wrap'), loadGiscus)
else loadGiscus()
} else {
window.loadOtherComment= loadGiscus
}
})()</script></div><div class="aplayer no-destroy" data-id="18480" data-server="netease" data-type="artist" data-fixed="true" data-mini="true" data-order="random" data-preload="metadata" data-autoplay="true" data-lrctype="3"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/npm/[email protected]/metingjs/dist/Meting.min.js"></script><script>(() => {
const destroyAplayer = () => {
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
}
const runMetingJS = () => {
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
}
btf.addGlobalFn('pjaxSend', destroyAplayer, 'destroyAplayer')
btf.addGlobalFn('pjaxComplete', loadMeting, 'runMetingJS')
})()</script><script src="https://cdn.jsdelivr.net/npm/[email protected]/pjax.min.js"></script><script>(() => {
const pjaxSelectors = ["link[rel=\"canonical\"]","meta[property=\"og:image\"]","meta[property=\"og:title\"]","meta[property=\"og:url\"]","head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]
window.pjax = new Pjax({
elements: 'a:not([target="_blank"])',
selectors: pjaxSelectors,
cacheBust: false,
analytics: false,
scrollRestoration: false
})
const triggerPjaxFn = (val) => {
if (!val) return
Object.values(val).forEach(fn => fn())
}
document.addEventListener('pjax:send', () => {
// removeEventListener
btf.removeGlobalFnEvent('pjaxSendOnce')
btf.removeGlobalFnEvent('themeChange')
// reset readmode
const $bodyClassList = document.body.classList
if ($bodyClassList.contains('read-mode')) $bodyClassList.remove('read-mode')
triggerPjaxFn(window.globalFn.pjaxSend)
})
document.addEventListener('pjax:complete', () => {
btf.removeGlobalFnEvent('pjaxCompleteOnce')
document.querySelectorAll('script[data-pjax]').forEach(item => {
const newScript = document.createElement('script')
const content = item.text || item.textContent || item.innerHTML || ""
Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
newScript.appendChild(document.createTextNode(content))
item.parentNode.replaceChild(newScript, item)
})
triggerPjaxFn(window.globalFn.pjaxComplete)
})
document.addEventListener('pjax:error', e => {
if (e.request.status === 404) {
pjax.loadUrl('/404.html')
}
})
})()</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>