kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* Query on git usage for creating patch with incremental commits
@ 2014-12-12 14:58 Kumar Amit Mehta
  2014-12-12 15:11 ` Manuel Mendez
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kumar Amit Mehta @ 2014-12-12 14:58 UTC (permalink / raw)
  To: kernelnewbies

Hi,

I know that it's not a typical Linux kernel related query but I reckon
that people involved in Linux kernel testing/development might have
gotten into similar situation. So, please bear with me for this rather
generic framework related query.

The scenario:
1: Cloned linux-next at time T1
$ git clone blahblah

2: Created a branch called development at T2
$ git checkout -b development

3: Made change1 in development branch and did a commit at T3
$ git commit -a

4: Made another commit in development branch and did another commit
at time T4, but during this development phase, *some* of the changes
that I made during my previous commit at time T3 were wrong, so had to
remove *some* of the changes
$ git commit -a

5: Now I create a branch called test, based off the master
$ git checkout -b test origin/master

5: So my test branch(and also the master branch) is two commits behind the
development branch. Now I wish to create a patch, based on my changes in
development branch and apply that patch to my test branch for further
testing. 

$ git format-patch origin/master -o patches
The above command creates two patches, which I need to apply in an
increasing order(0001 ---> 0002), otherwise, the patch won't work.

So far so good, but what If, I am not particularly proud of the first
patch, but have to send that anyway, If my patches are to be applied.
Another approach would be to create another branch, say development-again,
based of origin/master and make the necessary changes and then just
create one patch file. But I was wondering that while doing development,
don't we make commits in our working branches, which we think is
correct, only to find it ridiculous later (say after few more commits
in future) ? And what to do in such scenario ? Or how to use git to
solve such scenario.

Thanks,
Kumar

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Query on git usage for creating patch with incremental commits
  2014-12-12 14:58 Query on git usage for creating patch with incremental commits Kumar Amit Mehta
@ 2014-12-12 15:11 ` Manuel Mendez
  2014-12-12 15:43 ` Bjørn Mork
  2014-12-12 16:19 ` Mandeep Sandhu
  2 siblings, 0 replies; 5+ messages in thread
From: Manuel Mendez @ 2014-12-12 15:11 UTC (permalink / raw)
  To: kernelnewbies

git rebase -i master on development is your friend.

On Fri Dec 12 2014 at 9:59:27 AM Kumar Amit Mehta <gmate.amit@gmail.com>
wrote:

> Hi,
>
> I know that it's not a typical Linux kernel related query but I reckon
> that people involved in Linux kernel testing/development might have
> gotten into similar situation. So, please bear with me for this rather
> generic framework related query.
>
> The scenario:
> 1: Cloned linux-next at time T1
> $ git clone blahblah
>
> 2: Created a branch called development at T2
> $ git checkout -b development
>
> 3: Made change1 in development branch and did a commit at T3
> $ git commit -a
>
> 4: Made another commit in development branch and did another commit
> at time T4, but during this development phase, *some* of the changes
> that I made during my previous commit at time T3 were wrong, so had to
> remove *some* of the changes
> $ git commit -a
>
> 5: Now I create a branch called test, based off the master
> $ git checkout -b test origin/master
>
> 5: So my test branch(and also the master branch) is two commits behind the
> development branch. Now I wish to create a patch, based on my changes in
> development branch and apply that patch to my test branch for further
> testing.
>
> $ git format-patch origin/master -o patches
> The above command creates two patches, which I need to apply in an
> increasing order(0001 ---> 0002), otherwise, the patch won't work.
>
> So far so good, but what If, I am not particularly proud of the first
> patch, but have to send that anyway, If my patches are to be applied.
> Another approach would be to create another branch, say development-again,
> based of origin/master and make the necessary changes and then just
> create one patch file. But I was wondering that while doing development,
> don't we make commits in our working branches, which we think is
> correct, only to find it ridiculous later (say after few more commits
> in future) ? And what to do in such scenario ? Or how to use git to
> solve such scenario.
>
> Thanks,
> Kumar
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20141212/4f600d95/attachment.html 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Query on git usage for creating patch with incremental commits
  2014-12-12 14:58 Query on git usage for creating patch with incremental commits Kumar Amit Mehta
  2014-12-12 15:11 ` Manuel Mendez
@ 2014-12-12 15:43 ` Bjørn Mork
  2014-12-12 16:19 ` Mandeep Sandhu
  2 siblings, 0 replies; 5+ messages in thread
From: Bjørn Mork @ 2014-12-12 15:43 UTC (permalink / raw)
  To: kernelnewbies

Kumar Amit Mehta <gmate.amit@gmail.com> writes:

> So far so good, but what If, I am not particularly proud of the first
> patch, but have to send that anyway, If my patches are to be applied.
> Another approach would be to create another branch, say development-again,
> based of origin/master and make the necessary changes and then just
> create one patch file. But I was wondering that while doing development,
> don't we make commits in our working branches, which we think is
> correct, only to find it ridiculous later (say after few more commits
> in future) ? And what to do in such scenario ? Or how to use git to
> solve such scenario.

git rebase is made for things like this.  See
http://git-scm.com/book/en/v2/Git-Tools-Rewriting-History



Bj?rn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Query on git usage for creating patch with incremental commits
  2014-12-12 14:58 Query on git usage for creating patch with incremental commits Kumar Amit Mehta
  2014-12-12 15:11 ` Manuel Mendez
  2014-12-12 15:43 ` Bjørn Mork
@ 2014-12-12 16:19 ` Mandeep Sandhu
  2014-12-12 17:50   ` Kumar Amit Mehta
  2 siblings, 1 reply; 5+ messages in thread
From: Mandeep Sandhu @ 2014-12-12 16:19 UTC (permalink / raw)
  To: kernelnewbies

As others have pointed out, you need 'git rebase' here. With an
interactive rebase, you can cherry-pick what you want to do with each
commit (keep, edit, squash etc). It can also help you apply your
changes to a different  branch (using the '-- onto' option).

HTH,
-mandeep



On Fri, Dec 12, 2014 at 6:58 AM, Kumar Amit Mehta <gmate.amit@gmail.com> wrote:
> Hi,
>
> I know that it's not a typical Linux kernel related query but I reckon
> that people involved in Linux kernel testing/development might have
> gotten into similar situation. So, please bear with me for this rather
> generic framework related query.
>
> The scenario:
> 1: Cloned linux-next at time T1
> $ git clone blahblah
>
> 2: Created a branch called development at T2
> $ git checkout -b development
>
> 3: Made change1 in development branch and did a commit at T3
> $ git commit -a
>
> 4: Made another commit in development branch and did another commit
> at time T4, but during this development phase, *some* of the changes
> that I made during my previous commit at time T3 were wrong, so had to
> remove *some* of the changes
> $ git commit -a
>
> 5: Now I create a branch called test, based off the master
> $ git checkout -b test origin/master
>
> 5: So my test branch(and also the master branch) is two commits behind the
> development branch. Now I wish to create a patch, based on my changes in
> development branch and apply that patch to my test branch for further
> testing.
>
> $ git format-patch origin/master -o patches
> The above command creates two patches, which I need to apply in an
> increasing order(0001 ---> 0002), otherwise, the patch won't work.
>
> So far so good, but what If, I am not particularly proud of the first
> patch, but have to send that anyway, If my patches are to be applied.
> Another approach would be to create another branch, say development-again,
> based of origin/master and make the necessary changes and then just
> create one patch file. But I was wondering that while doing development,
> don't we make commits in our working branches, which we think is
> correct, only to find it ridiculous later (say after few more commits
> in future) ? And what to do in such scenario ? Or how to use git to
> solve such scenario.
>
> Thanks,
> Kumar
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Query on git usage for creating patch with incremental commits
  2014-12-12 16:19 ` Mandeep Sandhu
@ 2014-12-12 17:50   ` Kumar Amit Mehta
  0 siblings, 0 replies; 5+ messages in thread
From: Kumar Amit Mehta @ 2014-12-12 17:50 UTC (permalink / raw)
  To: kernelnewbies

On Fri, Dec 12, 2014 at 08:19:35AM -0800, Mandeep Sandhu wrote:
> As others have pointed out, you need 'git rebase' here. With an
> interactive rebase, you can cherry-pick what you want to do with each
> commit (keep, edit, squash etc). It can also help you apply your
> changes to a different  branch (using the '-- onto' option).
> 
> HTH,
> -mandeep
> 
> 
> 
> On Fri, Dec 12, 2014 at 6:58 AM, Kumar Amit Mehta <gmate.amit@gmail.com> wrote:
> > Hi,
> >
> > I know that it's not a typical Linux kernel related query but I reckon
> > that people involved in Linux kernel testing/development might have
> > gotten into similar situation. So, please bear with me for this rather
> > generic framework related query.
> >
> > The scenario:
> > 1: Cloned linux-next at time T1
> > $ git clone blahblah
> >
> > 2: Created a branch called development at T2
> > $ git checkout -b development
> >
> > 3: Made change1 in development branch and did a commit at T3
> > $ git commit -a
> >
> > 4: Made another commit in development branch and did another commit
> > at time T4, but during this development phase, *some* of the changes
> > that I made during my previous commit at time T3 were wrong, so had to
> > remove *some* of the changes
> > $ git commit -a
> >
> > 5: Now I create a branch called test, based off the master
> > $ git checkout -b test origin/master
> >
> > 5: So my test branch(and also the master branch) is two commits behind the
> > development branch. Now I wish to create a patch, based on my changes in
> > development branch and apply that patch to my test branch for further
> > testing.
> >
> > $ git format-patch origin/master -o patches
> > The above command creates two patches, which I need to apply in an
> > increasing order(0001 ---> 0002), otherwise, the patch won't work.
> >
> > So far so good, but what If, I am not particularly proud of the first
> > patch, but have to send that anyway, If my patches are to be applied.
> > Another approach would be to create another branch, say development-again,
> > based of origin/master and make the necessary changes and then just
> > create one patch file. But I was wondering that while doing development,
> > don't we make commits in our working branches, which we think is
> > correct, only to find it ridiculous later (say after few more commits
> > in future) ? And what to do in such scenario ? Or how to use git to
> > solve such scenario.

Thank you everyone for the pointers. I'll look into it.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-12 17:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-12 14:58 Query on git usage for creating patch with incremental commits Kumar Amit Mehta
2014-12-12 15:11 ` Manuel Mendez
2014-12-12 15:43 ` Bjørn Mork
2014-12-12 16:19 ` Mandeep Sandhu
2014-12-12 17:50   ` Kumar Amit Mehta

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).