File tree Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Expand file tree Collapse file tree 3 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,11 @@ submodule with the `--init` option.
149
149
+
150
150
If `--recursive` is specified, this command will recurse into the
151
151
registered submodules, and update any nested submodules within.
152
+ +
153
+ If `--force` is specified, the submodule will be checked out (using
154
+ `git checkout --force` if appropriate), even if the commit specified in the
155
+ index of the containing repository already matches the commit checked out in
156
+ the submodule.
152
157
153
158
summary::
154
159
Show commit summary between the given commit (defaults to HEAD) and
@@ -210,7 +215,9 @@ OPTIONS
210
215
This option is only valid for add and update commands.
211
216
When running add, allow adding an otherwise ignored submodule path.
212
217
When running update, throw away local changes in submodules when
213
- switching to a different commit.
218
+ switching to a different commit; and always run a checkout operation
219
+ in the submodule, even if the commit listed in the index of the
220
+ containing repository matches the commit checked out in the submodule.
214
221
215
222
--cached::
216
223
This option is only valid for status and summary commands. These
Original file line number Diff line number Diff line change @@ -564,7 +564,7 @@ Maybe you want to use 'update --init'?")"
564
564
die " $( eval_gettext " Unable to find current revision in submodule path '\$ sm_path'" ) "
565
565
fi
566
566
567
- if test " $subsha1 " ! = " $sha1 "
567
+ if test " $subsha1 " ! = " $sha1 " -o -n " $force "
568
568
then
569
569
subforce=$force
570
570
# If we don't already have a -f flag and the submodule has never been checked out
Original file line number Diff line number Diff line change @@ -123,6 +123,18 @@ test_expect_success 'submodule update should throw away changes with --force ' '
123
123
)
124
124
'
125
125
126
+ test_expect_success ' submodule update --force forcibly checks out submodules' '
127
+ (cd super &&
128
+ (cd submodule &&
129
+ rm -f file
130
+ ) &&
131
+ git submodule update --force submodule &&
132
+ (cd submodule &&
133
+ test "$(git status -s file)" = ""
134
+ )
135
+ )
136
+ '
137
+
126
138
test_expect_success ' submodule update --rebase staying on master' '
127
139
(cd super/submodule &&
128
140
git checkout master
You can’t perform that action at this time.
0 commit comments