* Creating Patches
@ 2014-06-03 16:45 me storage
2014-06-03 16:55 ` Valdis.Kletnieks at vt.edu
2014-06-03 21:03 ` Bernd Petrovitsch
0 siblings, 2 replies; 3+ messages in thread
From: me storage @ 2014-06-03 16:45 UTC (permalink / raw)
To: kernelnewbies
Hi i have one doubt when creating patch files. if consider a file a.txt it
contains
This
is
a
simple
file.
i added to git and commit it.
Next i changed the file as
This
is
a
slightly more complex
file.
Again i added to git and commit it.
Now if i create a patch by using the below commands
git format-patch -n HEAD
git show HEAD > somepatch.patch
the contents in somepatch.patch are shown below
commit 0e1d77b66e708580a07530e8c1bf20546a701c6f
Author: <UserName> <xxxxxxxxx@gmail.com>
Date: Tue Jun 3 22:02:57 2014 +0530
Next Commit
diff --git a/a.txt b/a.txt
index 76e499a..c341c1c 100644
--- a/a.txt
+++ b/a.txt
@@ -1,5 +1,5 @@
this
is
a
-simple
+slightly more complex file
file.
My doubt is how to create patch file which contains the modifications only
i.e lines with "+" only why because for example initially if a file
contains 1000 rows after i changed 2 lines but in the patch file it is
taking entire 1000+2 lines.So is there any way to generate patch with only
modified lines?
Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140603/763b1c4e/attachment.html
^ permalink raw reply related [flat|nested] 3+ messages in thread* Creating Patches
2014-06-03 16:45 Creating Patches me storage
@ 2014-06-03 16:55 ` Valdis.Kletnieks at vt.edu
2014-06-03 21:03 ` Bernd Petrovitsch
1 sibling, 0 replies; 3+ messages in thread
From: Valdis.Kletnieks at vt.edu @ 2014-06-03 16:55 UTC (permalink / raw)
To: kernelnewbies
On Tue, 03 Jun 2014 22:15:21 +0530, me storage said:
> diff --git a/a.txt b/a.txt
> index 76e499a..c341c1c 100644
> --- a/a.txt
> +++ b/a.txt
> @@ -1,5 +1,5 @@
> this
> is
> a
> -simple
> +slightly more complex file
> file.
>
>
> My doubt is how to create patch file which contains the modifications only
> i.e lines with "+" only why because for example initially if a file
> contains 1000 rows.
It's showing the first 3 lines and the last line because of "context" - when
the patch is finally applied, the change may not apply at line 4, due to *other*
patches having added/deleted lines. Usually git will display 3 lines either
side of the changed line.
Go ahead, create a 25 line patch, and change line 15, and see what the diff
shows then.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140603/02bba6d7/attachment.bin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Creating Patches
2014-06-03 16:45 Creating Patches me storage
2014-06-03 16:55 ` Valdis.Kletnieks at vt.edu
@ 2014-06-03 21:03 ` Bernd Petrovitsch
1 sibling, 0 replies; 3+ messages in thread
From: Bernd Petrovitsch @ 2014-06-03 21:03 UTC (permalink / raw)
To: kernelnewbies
On Die, 2014-06-03 at 22:15 +0530, me storage wrote:
[...]
> My doubt is how to create patch file which contains the modifications only
> i.e lines with "+" only why because for example initially if a file
> contains 1000 rows after i changed 2 lines but in the patch file it is
> taking entire 1000+2 lines.So is there any way to generate patch with only
> modified lines?
Well, you are extrapolating from your simple (and thus quite small) lab
test to the (big;-) reality without actually trying it.
That is more often than not not working anyways (and IMHO it doesn't
work at all in almost all cases).
So it would have been better to actually to simply try a `diff` (with
and without `git`) on a file with 1000 lines.
Kind regards,
Bernd
--
"What happens when you read some doc and either it doesn't answer your
question or is demonstrably wrong? In Linux, you say "Linux sucks" and
go read the code. In Windows/Oracle/etc you say "Windows sucks" and
start banging your head against the wall." - Denis Vlasenko on lkml
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-03 21:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-03 16:45 Creating Patches me storage
2014-06-03 16:55 ` Valdis.Kletnieks at vt.edu
2014-06-03 21:03 ` Bernd Petrovitsch
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).