managing patches with git

Daniel Stone daniel at fooishbar.org
Tue Jun 25 15:18:13 PDT 2013


Hi,

On 25 June 2013 23:13, Alan Coopersmith <alan.coopersmith at oracle.com> wrote:
> On 06/25/13 02:31 PM, Thomas Klausner wrote:
>> Btw, what's the appropriate method to create a patch that's a merged
>> version of previous patches, which are separate commits in my local
>> copy of the repository? Just creating diffs against origin like I do
>> now creates patches in a different format. On the other hand, checking
>> out HEAD again, copying the change over and making a new commit is a
>> bit much effort. There must be an easier way.
>
> To resync with HEAD, I use "git pull --rebase".
>
> To merge patches, or change previous ones, I use "git rebase -i origin",
> especially with the "squash" and "fixup" options (or "reword" if I'm
> just adding reviewed-by tags & similar commit comment changes).

For a single commit, you can just do git commit -a --amend, to squash
the entire working tree together with the top-of-tree commit.  I have
git commit -a --amend -c HEAD aliased to git caa, for when I want to
do this whilst preserving the commit message from the previous commit,
not being prompted about it.

Cheers,
Daniel


More information about the xorg-devel mailing list