Recommended approach to refreshing only part of a file?

Skip to first unread message

Leigh McCulloch

Apr 7, 2021, 1:12:58 AM4/7/21
to StGit (Stacked Git)
Hi folks,

What's the recommended approach or workflow for refreshing only part of a file. For example, if I'm working on a patch and have made some changes to a file that I want to keep but not include in this patch, how do I refresh into the patch only the changes I desire.

I'm looking for the analogous action as doing git commit --patch that allows me to interactively choose which parts of the diff to commit.

I'm relatively new to stacked-git. I've looked for the answer to this in the tools help and in the manual.


Peter Grayson

Apr 7, 2021, 9:05:08 AM4/7/21
to StGit (Stacked Git)
Hi Leigh,

This is a good question.

You can use git add --patch to interactively choose which hunks to stage to the index. You can then use stg refresh --index to refresh the current patch with just those staged hunks.


Topher Brown

Jul 5, 2021, 12:59:04 PM7/5/21
to StGit (Stacked Git)
Here's a screencast of the workflow Pete is describing:

I even have an alias to make this easier:

alias srpa='git add --patch && stg refresh --index'

Highly recommend -- I use this all the time!

Reply all
Reply to author
0 new messages