or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
7.7 0504 git reset 回到上一步; git tag 標籤
git reset
+index
若此時我們想回到
master
分支上前一個commit的狀態:git reset 85e7e30
e12d8ef
暫時看不見了 (而不是砍掉)git reset
--參數
決定檔案去留-- hard
工作目錄和暫存區的內容都丟掉(直接丟掉)-- soft
工作目錄和暫存區的內容都不變(檔案丟回暫存區)(預設)
--mixed
工作目錄不變,暫存區內容丟掉(檔案丟回工作目錄)hard
-- hard
工作目錄和暫存區的內容都丟掉(直接丟掉)指令:
git reset5 85e7e30 --hard
重點1. 復原
--hard
裡被丟掉的工作目錄和暫存區內容A. 絕對定位
(1) command line
指令:
git reset e12d8ef --hard
原本的最後一次commit:
e12d8ef
意義:
(2) GUI軟體: source tree
在想要復原的commit上按右鍵
->
Reset current branch to this commit
->
Using mode:
B. 相對定位
想回到某個commit的上一個、上兩個commit
^
= Caret (卡瑞特)~
= Tilde (提爾達)^
Caret~
Tilde用HEAD當代名詞
git reset HEAD~2
: 我想要變成HEAD的前2個狀態!重點2. 查詢不見的commit:
git reflog
reflog = reference log
列出HEAD移動的軌跡圖
soft
-- soft
工作目錄和暫存區的內容都不變(檔案丟回暫存區)mixed (預設)
--mixed
工作目錄不變,暫存區內容丟掉(檔案丟回工作目錄)reset和checkout的差異
checkout: 去其他的commit看看
git tag
+版本號
Q: 為什麼要用標籤?
A: 不想要記得一長串文數字
tag的使用情境
里程碑 (產品更新上線)
git tag 1.0.0 cef6e40
tag 用於
git reset
tag 用於
git checkout
tag 和 branch 的差異
標籤和分支有什麼不同