質問編集履歴
2
fix text
title
CHANGED
File without changes
|
body
CHANGED
@@ -4,9 +4,8 @@
|
|
4
4
|
`git checkout .`(ピリオド)
|
5
5
|
`git reset --hard HEAD`
|
6
6
|
|
7
|
-
通常`git checkout`はブランチを切り替える目的で使い、リビジョンを引数に指定しますが、`git checkout .`では何を指定しているのでしょうか。
|
7
|
+
通常`git checkout`はブランチを切り替える目的で使い、リビジョンを引数に指定しますが、`git checkout .`では何を指定しているのでしょうか。ピリオドがHEADを指すわけでもないようですね。(下記)
|
8
8
|
|
9
|
-
`git checkout HEAD`と`git checkout .`
|
10
9
|
|
11
10
|
```bash
|
12
11
|
$ git status
|
1
テストの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,5 +1,60 @@
|
|
1
1
|
下記のコマンド二種はどう違いますか?
|
2
2
|
普段、コミットしていない変更を元に戻す際には、git reset --hard HEADを使っていますが、git checkout . を使う状況があれば教えて下さい。
|
3
3
|
|
4
|
-
git checkout .(ピリオド)
|
4
|
+
`git checkout .`(ピリオド)
|
5
|
-
git reset --hard HEAD
|
5
|
+
`git reset --hard HEAD`
|
6
|
+
|
7
|
+
通常`git checkout`はブランチを切り替える目的で使い、リビジョンを引数に指定しますが、`git checkout .`では何を指定しているのでしょうか。同じcheckoutコマンドにもかかわらず動作が異なるように見えるので気になります。
|
8
|
+
|
9
|
+
`git checkout HEAD`と`git checkout .`
|
10
|
+
|
11
|
+
```bash
|
12
|
+
$ git status
|
13
|
+
On branch branch_a
|
14
|
+
Changes to be committed:
|
15
|
+
(use "git reset HEAD <file>..." to unstage)
|
16
|
+
|
17
|
+
modified: aaaa
|
18
|
+
|
19
|
+
Changes not staged for commit:
|
20
|
+
(use "git add <file>..." to update what will be committed)
|
21
|
+
(use "git checkout -- <file>..." to discard changes in working directory)
|
22
|
+
|
23
|
+
modified: cccc
|
24
|
+
|
25
|
+
$ git checkout .
|
26
|
+
$ git status
|
27
|
+
On branch branch_a
|
28
|
+
Changes to be committed:
|
29
|
+
(use "git reset HEAD <file>..." to unstage)
|
30
|
+
|
31
|
+
modified: aaaa
|
32
|
+
|
33
|
+
$ touch dddd
|
34
|
+
$ git status
|
35
|
+
On branch branch_a
|
36
|
+
Changes to be committed:
|
37
|
+
(use "git reset HEAD <file>..." to unstage)
|
38
|
+
|
39
|
+
modified: aaaa
|
40
|
+
|
41
|
+
Untracked files:
|
42
|
+
(use "git add <file>..." to include in what will be committed)
|
43
|
+
|
44
|
+
dddd
|
45
|
+
|
46
|
+
$ git checkout HEAD
|
47
|
+
M aaaa
|
48
|
+
$ git status
|
49
|
+
On branch branch_a
|
50
|
+
Changes to be committed:
|
51
|
+
(use "git reset HEAD <file>..." to unstage)
|
52
|
+
|
53
|
+
modified: aaaa
|
54
|
+
|
55
|
+
Untracked files:
|
56
|
+
(use "git add <file>..." to include in what will be committed)
|
57
|
+
|
58
|
+
dddd
|
59
|
+
|
60
|
+
```
|