File tree 1 file changed +42
-0
lines changed
1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,48 @@ others won't be able to clone the repository:
181
181
Did you forget to 'git add'?
182
182
Unable to checkout '261dfac35cb99d380eb966e102c1197139f7fa24' in submodule path 'a'
183
183
184
+ If you are staging an updated submodule for commit manually, be careful to not
185
+ add a trailing slash when specifying the path. With the slash appended, Git
186
+ will assume you are removing the submodule and checking that directory's
187
+ contents into the containing repository.
188
+
189
+ $ cd ~/git/super/a
190
+ $ echo i added another line to this file >> a.txt
191
+ $ git commit -a -m "doing it wrong this time"
192
+ $ cd ..
193
+ $ git add a/
194
+ $ git status
195
+ # On branch master
196
+ # Changes to be committed:
197
+ # (use "git reset HEAD <file>..." to unstage)
198
+ #
199
+ # deleted: a
200
+ # new file: a/a.txt
201
+ #
202
+ # Modified submodules:
203
+ #
204
+ # * a aa5c351...0000000 (1):
205
+ # < Initial commit, submodule a
206
+ #
207
+
208
+ To fix the index after performing this operation, reset the changes and then
209
+ add the submodule without the trailing slash.
210
+
211
+ $ git reset HEAD A
212
+ $ git add a
213
+ $ git status
214
+ # On branch master
215
+ # Changes to be committed:
216
+ # (use "git reset HEAD <file>..." to unstage)
217
+ #
218
+ # modified: a
219
+ #
220
+ # Modified submodules:
221
+ #
222
+ # * a aa5c351...8d3ba36 (1):
223
+ # > doing it wrong this time
224
+ #
225
+
184
226
You also should not rewind branches in a submodule beyond commits that were
185
227
ever recorded in any superproject.
186
228
You can’t perform that action at this time.
0 commit comments