|
|
| 第1行: |
第1行: |
|
| |
|
|
| |
| == 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}}
| |
|
| |
|
| == 其他 == | | == 其他 == |