-
I am pretty new to stacked-git, but it's really coming in handy for some code I am working on at the moment. 🙏 However, I got a little stuck, I have a series of patches like this:
I want to squash all the package.json updates into the first patch, so the final stack of patches is like this:
But I can't figure out a good way to split an existing patch? I tried something like the stg goto <patch-to-split>
git reset HEAD^ # rewind the index/staging area by 1 without changing the working tree
git add package.json
stg refresh --index --patch <first-patch> However at this point I got an error:
After I tried the Wonder if I am just thinking about this the wrong way? Would appreciate any advice or suggestions. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hello, after I wrote this I started thinking about the problem again and started browsing through the source code. I found exactly what I want, the command is:
https://stacked-git.github.io/man/stg-refresh/ So, for example, for my case to move the package.json update to another patch: stg goto <patch-to-split>
stg refresh --spill
git reset # unstage all files, this seems to work fine?
git add package.json
stg refresh --index --patch <first-patch> # add "package.json" to the first patch instead
stg refresh # put the remaining files in the current patch |
Beta Was this translation helpful? Give feedback.
-
There are other ways to achieve what you want. It usually depends how larger/messy the commits are.
|
Beta Was this translation helpful? Give feedback.
-
I wrote this script a while ago, I've been using it for years. I can submit it to the contrib directory is there is interest. |
Beta Was this translation helpful? Give feedback.
Hello, after I wrote this I started thinking about the problem again and started browsing through the source code. I found exactly what I want, the command is:
https://stacked-git.github.io/man/stg-refresh/
So, for example, for my case to move the package.json update to another patch: