回答編集履歴

3

追記

2018/05/26 15:06

投稿

tkmtmkt
tkmtmkt

スコア1800

test CHANGED
@@ -41,3 +41,129 @@
41
41
  $ git commit
42
42
 
43
43
  ```
44
+
45
+
46
+
47
+ **追記2**
48
+
49
+
50
+
51
+ 以下のように確認作業を行ってみました。
52
+
53
+
54
+
55
+ ```sh
56
+
57
+ $ mkdir -p zzz/directory1
58
+
59
+
60
+
61
+ # directory1にgitリポジトリ作成してファイルを登録
62
+
63
+ $ cd zzz/directory1
64
+
65
+ $ git init
66
+
67
+ $ touch hoge fuga
68
+
69
+ $ git add .
70
+
71
+ $ git commit -m INIT
72
+
73
+
74
+
75
+ # zzzにgitリポジトリ作成してdirectory1を登録
76
+
77
+ $ cd ..
78
+
79
+ $ git init
80
+
81
+ $ git add .
82
+
83
+ warning: adding embedded git repository: direcotory1
84
+
85
+ ヒント: You've added another git repository inside your current repository.
86
+
87
+ ヒント: Clones of the outer repository will not contain the contents of
88
+
89
+ ヒント: the embedded repository and will not know how to obtain it.
90
+
91
+ ヒント: If you meant to add a submodule, use:
92
+
93
+ ヒント:
94
+
95
+ ヒント: git submodule add <url> direcotory1
96
+
97
+ ヒント:
98
+
99
+ ヒント: If you added this path by mistake, you can remove it from the
100
+
101
+ ヒント: index with:
102
+
103
+ ヒント:
104
+
105
+ ヒント: git rm --cached direcotory1
106
+
107
+ ヒント:
108
+
109
+ ヒント: See "git help submodule" for more information.
110
+
111
+
112
+
113
+ $ git commit -m INIT
114
+
115
+
116
+
117
+ # directory1のgitリポジトリを削除して状態確認
118
+
119
+ $ rm -rf direcotory1/.git
120
+
121
+ $ git status
122
+
123
+ ブランチ master
124
+
125
+ nothing to commit, working tree clean
126
+
127
+
128
+
129
+ # directory1内のファイルを登録してみる
130
+
131
+ $ git add direcotory1/*
132
+
133
+ fatal: Pathspec 'direcotory1/fuga' is in submodule 'direcotory1'
134
+
135
+ ```
136
+
137
+
138
+
139
+ directory1がサブモジュールとして登録されていると、directory1のgitリポジトリを削除してもdirectory1以下のファイルをリポジトリに追加できないようです。
140
+
141
+
142
+
143
+ 以下のようにdirectory1を一旦削除することで、directory1以下のファイルを追加することができました。
144
+
145
+
146
+
147
+ ```sh
148
+
149
+ $ git rm --cached direcotory1
150
+
151
+ $ git add .
152
+
153
+ $ git status
154
+
155
+ ブランチ master
156
+
157
+ コミット予定の変更点:
158
+
159
+ (use "git reset HEAD <file>..." to unstage)
160
+
161
+
162
+
163
+ deleted: direcotory1
164
+
165
+ new file: direcotory1/fuga
166
+
167
+ new file: direcotory1/hoge
168
+
169
+ ```

2

追記

2018/05/26 15:06

投稿

tkmtmkt
tkmtmkt

スコア1800

test CHANGED
@@ -19,3 +19,25 @@
19
19
  $ git status ignored
20
20
 
21
21
  ```
22
+
23
+
24
+
25
+ **追記**
26
+
27
+
28
+
29
+ directory1がリポジトリになっているため、directory1の親ディレクトリのリポジトリからは管理対象とされないようです。
30
+
31
+ directory1がリポジトリになっているのが間違いなら、directory1内の.gitディレクトリを削除してください。
32
+
33
+
34
+
35
+ ```sh
36
+
37
+ $ rm -rf direcotry1/.git
38
+
39
+ $ git add .
40
+
41
+ $ git commit
42
+
43
+ ```

1

誤記修正

2018/05/26 13:57

投稿

tkmtmkt
tkmtmkt

スコア1800

test CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
 
8
8
 
9
- '''sh
9
+ ```sh
10
10
 
11
11
  # リポジトリで管理しているファイルを一覧表示する
12
12
 
@@ -18,4 +18,4 @@
18
18
 
19
19
  $ git status ignored
20
20
 
21
- '''
21
+ ```