[Libreoffice] Need help to generate patch with git

Kohei Yoshida kohei.yoshida at suse.com
Tue Aug 30 18:17:00 PDT 2011


Hi Regina,

On Tue, 2011-08-30 at 23:29 +0200, Regina Henschel wrote:
> Hi all,
> 
> I'm still learning to use git and need some help. I have made a patch 
> for issue 34431. But after I used the 'commit' command I noticed, that I 
> had to change a file, which needs another 'commit'. Now the command 
> 'format-patch' has produced two files, one for each commit. Is there a 
> way, to get _one_ patch file?

Yes.  You can use git rebase --interactive for that (or git rebase -i
for short).  It allows you to combine several of your local commits into
a single commit.

But be warned that this command is a bit hard to use and can screw with
your commits when used incorrectly.  So I recommend you have some
practice runs to get comfortable with it first.  That said, this is an
indispensable command that I personally use all the time to combine
several of my local commits before pushing.  So it's worth spending some
time to learn this command.

> I want to use the same build to work on a different problem (Getting 
> non-filled line end markers). How can I do that, so that later on, a 
> 'format-patch' will generate only the new changes and not those for 
> issue 34431 too?

What I recommend is that you create a separate branch for each problem
to solve.  Switching between branches is pretty fast with git, so that's
another technique you can learn with git.  You can easily delete
branches after you are done.  Creation and deletion of branches with git
are very cheap, so I recommend you learn how to make effective use of
git's branches.

HTH,

Kohei

-- 
Kohei Yoshida, LibreOffice hacker, Calc
<kohei.yoshida at suse.com>



More information about the LibreOffice mailing list