Re: "git apply" can't add new files to repo ?
On Fri, 2011-07-15 at 12:02 -0700, Yang wrote:
Show 12 quoted lines
> I created a patch by "git format-patch", and this patch includes some
> newly-added files.
>
> when I got back to the original branch, and apply this patch, the new
> files appear, but they are not
> added to git repository, so I have to manually find all the new files
> and do "git add" for each of them.
>
>
> I guess there should have been a way to automatically do "git add" for
> all the new files in the patch,
> how could I do that?
git-apply is just a wrapper around the patch(1) utility. As you have created a patch for use in an email (as that's the point of using format-patch, so you have both the commit message and diff in one place), you should use git-am, which takes care of all the "magic". If you want to change what the patch does, you just need to use git commit --amend
Cheers,
cmn
--
Carlos Martín Nieto http://www.cmartin.tk
"¿Cómo voy a decir bobadas si soy mudo?" -- CACHAI