@@ -41,6 +41,7 @@ export type OptionsForGitStackedRebase = {
4141
4242	viewTodoOnly : boolean ; 
4343	apply : boolean ; 
44+ 	continue : boolean ; 
4445	push : boolean ; 
4546	forcePush : boolean ; 
4647
@@ -61,6 +62,7 @@ export const getDefaultOptions = (): OptionsForGitStackedRebase => ({
6162	gitCmd : process . env . GIT_CMD  ??  defaultGitCmd , 
6263	viewTodoOnly : false , 
6364	apply : false , 
65+ 	continue : false , 
6466	push : false , 
6567	forcePush : false , 
6668	branchSequencer : false , 
@@ -73,6 +75,7 @@ function areOptionsIncompetible(
7375) : boolean  { 
7476	if  ( options . viewTodoOnly )  { 
7577		if  ( options . apply )  reasons . push ( "--apply cannot be used together with --view-todo" ) ; 
78+ 		if  ( options . continue )  reasons . push ( "--continue cannot be used together with --view-todo" ) ; 
7679		if  ( options . push )  reasons . push ( "--push cannot be used together with --view-todo" ) ; 
7780		if  ( options . forcePush )  reasons . push ( "--push --force cannot be used together with --view-todo" ) ; 
7881		if  ( options . branchSequencer )  reasons . push ( "--branch-sequencer cannot be used together with --view-todo" ) ; 
@@ -284,6 +287,8 @@ export const gitStackedRebase = async (
284287		const  pathToStackedRebaseDirInsideDotGit : string  =  parsed . pathToStackedRebaseDirInsideDotGit ; 
285288		const  pathToStackedRebaseTodoFile : string  =  parsed . pathToStackedRebaseTodoFile ; 
286289
290+ 		const  checkIsRegularRebaseStillInProgress  =  ( ) : boolean  =>  fs . existsSync ( pathToRegularRebaseDirInsideDotGit ) ; 
291+ 
287292		if  ( fs . existsSync ( path . join ( pathToStackedRebaseDirInsideDotGit ,  filenames . willNeedToApply ) ) )  { 
288293			_markThatNeedsToApply ( pathToStackedRebaseDirInsideDotGit ) ; 
289294		} 
@@ -298,6 +303,35 @@ export const gitStackedRebase = async (
298303			} ) ; 
299304		} 
300305
306+ 		if  ( options . continue )  { 
307+ 			execSyncInRepo ( `${ options . gitCmd }   rebase --continue` ) ; 
308+ 
309+ 			if  ( checkIsRegularRebaseStillInProgress ( ) )  { 
310+ 				/** 
311+ 				 * still not done - further `--continue`s will be needed. 
312+ 				 */ 
313+ 				return ; 
314+ 			} 
315+ 
316+ 			console . log ( "after --continue, rebase done. trying to --apply" ) ; 
317+ 
318+ 			/** 
319+ 			 * rebase has finished. we can try to --apply now 
320+ 			 * so that the partial branches do not get out of sync. 
321+ 			 */ 
322+ 			await  applyIfNeedsToApply ( { 
323+ 				repo, 
324+ 				pathToStackedRebaseTodoFile, 
325+ 				pathToStackedRebaseDirInsideDotGit,  // 
326+ 				rootLevelCommandName : "--apply (automatically after --continue)" , 
327+ 				gitCmd : options . gitCmd , 
328+ 				autoApplyIfNeeded : configValues . autoApplyIfNeeded , 
329+ 				config, 
330+ 			} ) ; 
331+ 
332+ 			return ; 
333+ 		} 
334+ 
301335		const  {  neededToApply,  userAllowedToApplyAndWeApplied,  markThatNeedsToApply }  =  await  applyIfNeedsToApply ( { 
302336			repo, 
303337			pathToStackedRebaseTodoFile, 
@@ -357,7 +391,7 @@ export const gitStackedRebase = async (
357391		) ; 
358392		const  currentBranch : Git . Reference  =  await  repo . getCurrentBranch ( ) ; 
359393
360- 		const  wasRegularRebaseInProgress : boolean  =  fs . existsSync ( pathToRegularRebaseDirInsideDotGit ) ; 
394+ 		const  wasRegularRebaseInProgress : boolean  =  checkIsRegularRebaseStillInProgress ( ) ; 
361395		// const 
362396
363397		console . log ( {  wasRegularRebaseInProgress } ) ; 
@@ -1341,6 +1375,16 @@ git-stacked-rebase <branch> [-a|--apply]
13411375	2. but wil not push the partial branches to a remote until --push --force is used. 
13421376
13431377
1378+ git-stacked-rebase <branch> [-c|--continue] 
1379+ 
1380+ 	(!) should be used instead of git-rebase's --continue 
1381+ 
1382+ 	...because, additionally to invoking git rebase --continue, 
1383+ 	this option automatically (prompts you to) --apply (if the rebase 
1384+ 	has finished), thus ensuring that the partial branches 
1385+ 	do not go out of sync with the newly rewritten history. 
1386+ 
1387+ 
13441388git-stacked-rebase <branch> [--push|-p --force|-f] 
13451389
13461390    1. will checkout each branch and will push --force, 
@@ -1446,10 +1490,11 @@ git-stacked-rebase ${gitStackedRebaseVersionStr} __BUILD_DATE_REPLACEMENT_STR__
14461490	const  isViewTodoOnly : boolean  = 
14471491		! ! second  &&  [ "--view-todo" ,  "-v" ,  "--view-only" ,  "--view-todo-only" ] . includes ( second ) ; 
14481492	const  isApply : boolean  =  ! ! second  &&  [ "--apply" ,  "-a" ] . includes ( second ) ; 
1493+ 	const  isContinue : boolean  =  ! ! second  &&  [ "--continue" ,  "-c" ] . includes ( second ) ; 
14491494	const  isPush : boolean  =  ! ! second  &&  [ "--push" ,  "-p" ] . includes ( second ) ; 
14501495	const  isBranchSequencer : boolean  =  ! ! second  &&  [ "--branch-sequencer" ,  "--bs" ,  "-s" ] . includes ( second ) ; 
14511496
1452- 	if  ( isViewTodoOnly  ||  isApply  ||  isPush  ||  isBranchSequencer )  { 
1497+ 	if  ( isViewTodoOnly  ||  isContinue   ||   isApply  ||  isPush  ||  isBranchSequencer )  { 
14531498		eatNextArg ( ) ; 
14541499	} 
14551500
@@ -1499,6 +1544,7 @@ git-stacked-rebase ${gitStackedRebaseVersionStr} __BUILD_DATE_REPLACEMENT_STR__
14991544		gitDir, 
15001545		viewTodoOnly : isViewTodoOnly , 
15011546		apply : isApply , 
1547+ 		continue : isContinue , 
15021548		push : isPush , 
15031549		forcePush : isForcePush , 
15041550		branchSequencer : isBranchSequencer , 
0 commit comments