I have made a few changes to a branch on my git repository. However, I would like to add/stage those changes in batches of different commits.
For this, I usually add files with the -e
or -p
flag to include only the bits I want.
Unfortunately, this usually takes ages since I have to keep counting the lines added and removed so I can update the hunk header i.e @@ -32,7 +32,7 @@
.
I have found out that git apply
has a flag called --recount
which basically ignore hunk headers and do the math based on the diff however I am not sure if git apply
will just stage the files or replace the files content with the diff.
Anyway, I would like to know if there is any less painful way to perform git add -e
without having to recalculate all hunk headers while staging only smaller bits of the file?
I was looking for a native way to do that within git itself without having to use a GUI application, if that is at all possible?