Skip to content

Commit ddf4a58

Browse files
committed
add reset command to perform a forced reclone
1 parent a04d8c2 commit ddf4a58

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/git-subrepo

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ git subrepo <command> <arguments> <options>
3737
Commands:
3838
clone Clone a remote repository into a local subdirectory
3939
init Turn a current subdirectory into a subrepo
40+
reset Reset subrepo performing a forced reclone
4041
pull Pull upstream changes to the subrepo
4142
push Push local subrepo changes upstream
4243
@@ -178,6 +179,16 @@ main() {
178179
# info to the user.
179180
#------------------------------------------------------------------------------
180181

182+
command:reset() {
183+
command-setup +subdir
184+
185+
local reclone_up_to_date=false
186+
force_wanted=true
187+
subrepo:clone
188+
189+
say "Subrepo '$subdir' reset to '$subrepo_remote' ($subrepo_branch)."
190+
}
191+
181192
# `git subrepo clone <url> [<subdir>]` command:
182193
command:clone() {
183194
command-setup +subrepo_remote subdir:guess-subdir
@@ -1077,6 +1088,7 @@ get-command-options() {
10771088
}
10781089

10791090
options_help='all'
1091+
options_reset='branch remote'
10801092
options_branch='all fetch force'
10811093
options_clean='ALL all force'
10821094
options_clone='branch edit force message method'

0 commit comments

Comments
 (0)