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.
149149+
150150If `--recursive` is specified, this command will recurse into the
151151registered 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.
152157
153158summary::
154159 Show commit summary between the given commit (defaults to HEAD) and
@@ -210,7 +215,9 @@ OPTIONS
210215 This option is only valid for add and update commands.
211216 When running add, allow adding an otherwise ignored submodule path.
212217 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.
214221
215222--cached::
216223 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'?")"
564564 die " $( eval_gettext " Unable to find current revision in submodule path '\$ sm_path'" ) "
565565 fi
566566
567- if test " $subsha1 " ! = " $sha1 "
567+ if test " $subsha1 " ! = " $sha1 " -o -n " $force "
568568 then
569569 subforce=$force
570570 # 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 ' '
123123 )
124124'
125125
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+
126138test_expect_success ' submodule update --rebase staying on master' '
127139 (cd super/submodule &&
128140 git checkout master
You can’t perform that action at this time.
0 commit comments