Git/提交修改:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
创建页面,内容为“== 提交 == === add === {| class="wikitable" |- ! 参数!! 描述 !! 示例 |- | . || 当前目录全部,递归子目录 || git add . |- | --all || 当前项目全部,递归子目录 || git add --all |- | 文件相对地址 || 部分 || git add src/a.js |} === commit ===”
 
Kangkk​(留言 | 贡献)
 
(未显示同一用户的2个中间版本)
第13行: 第13行:


=== commit ===
=== commit ===
== commit ==
{{Shc_out|<syntaxhighlight lang="bash">
git log --stat</syntaxhighlight>|<syntaxhighlight lang="bash">commit 1c791646bf9605c4380f94a84f3a89b8cc2fb60c (HEAD -> dev)
Merge: 823544a 2b2fa58
Author: kangjian <kangjian@360.cn>
Date:  Tue Jul 13 11:41:29 2021 +0800
    修改登录页大小
commit 823544a7986d8e2913d443af0a58290b3fbc1f50
Author: kangjian <kangjian@360.cn>
Date:  Tue Jul 13 11:36:16 2021 +0800
    修改登录页大小
ph-test/.gitignore                                                                                  |  6 +++---
ph-test/plugin/sign/net.qihoo.design/META-INF/signatures.xml                                        |  10 +++++-----
...ndex_page_script.66bceac724c9b0717f19.min.css => index_page_script.3898d67102797bd90e12.min.css} |  2 +-
.../css/{main_style.66bceac724c9b0717f19.min.css => main_style.3898d67102797bd90e12.min.css}        |  0
ph-test/plugin/sign/net.qihoo.design/index.html                                                    |  2 +-
.../net.qihoo.design/js/{index_page_script.66bceac7.min.js => index_page_script.3898d671.min.js}    |  0
.../js/{index_page_script.66bceac7.min.js.gz => index_page_script.3898d671.min.js.gz}              | Bin
ph-test/plugin/sign/net.qihoo.design/manifest.json                                                  |  8 ++++----
ph-test/view/page/login/Frame.vue                                                                  |  11 +++++++----
9 files changed, 21 insertions(+), 18 deletions(-)
</syntaxhighlight>|$|/home/kangkk}}
=== 参考 ===
* https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E6%9F%A5%E7%9C%8B%E6%8F%90%E4%BA%A4%E5%8E%86%E5%8F%B2
== commit ==
=== rebase ===
=== reset ===
<div class="pageBoxGreen"><code>^</code> 表示前一次。<code>^^^^</code> 等价于 <code>~4</code>。<br>
{{hcdiff|head=|output=<syntaxhighlight lang="bash">
git reset fb69f9d^^^^</syntaxhighlight>|output2=<syntaxhighlight lang="bash">
git reset fb69f9d~4
</syntaxhighlight>}}</div>
取消最后一次 commit。
{{shc|<syntaxhighlight lang="bash">
git reset fb69f9d^
# or
git reset master^
# or
git reset HEAD^</syntaxhighlight>|$|/home/kangkk}}
回退到指定 commit
{{shc|<syntaxhighlight lang="bash">
git reset fb69f9d</syntaxhighlight>|$|/home/kangkk}}
==== --mixed ====
==== soft ====
==== hard ====
=== --amend ===
=== 追加文件到 commit ===
==== reset ====
删除最后一次 commit,重新 commit。
==== --amend --no-edit ====
将文件并入最后一次 commit。使用 <code>--no-edit</code> 标识不进行编辑 commit 信息。
{{shc|<syntaxhighlight lang="bash">
git add src/a.js && \
git commit --amend --no-edit</syntaxhighlight>|$|/home/kangkk}}
== 命令合并 ==
现在我们将文件 a.js 加入暂存区并提交 commit 信息。
<syntaxhighlight lang="bash">
git add /src/a.js
git commit -m "edit the file"</syntaxhighlight>
可以将存储至暂存区和打 commit 的两个命令进行简化为一行。
<syntaxhighlight lang="bash">
git commit -a -m "edit the file"
</syntaxhighlight>