autra autra - 14 days ago 9
Git Question

With git, how to save/pause a ongoing big rebase to do something else, then go back to it?

So I have started to rebase a big branch on my current master (75 commits). I know it will take me a day or so. In the meantime, I need to address some comments on another PR.

How can I suspend my current rebase to amend my PR without re-cloning the repo or copying the folder (these would work of course)? Is this even possible?

wjl wjl
Answer

There is no built-in way to "pause" a rebase that I know of, although you can certainly accomplish something like it with enough git finesse.

However, in the case you've described, a much simpler solution is simply to do your rebase in one working directory, and do the other changes you need to do in a different working directory.

To get a new working directory, you can either:

  • Use a simple git clone to get a new working directory (AND a local repository, so you'll need to push/pull your results pack the original working directory).

  • Or, take a look at git worktree, which can help you manage multiple worktrees using the exact same repository data.

Comments