Re: the simplest way to add a file to my git repo and submit as a patch?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/5/07, Robert P. J. Day <rpjday@xxxxxxxxxxxxxx> wrote:

  what's the easiest way to submit a patch that represents adding a
new file to my git repo?  i'm fairly sure it involves "git add" and
"git commit".  i just want to be able to physically add the file, then
somehow commit it so it shows up with "git diff", submit that output
as a patch, then remove the file and any reference to it and get back
to where i started.

  what's the recipe?  thanks.

Depends on if you work on branches (which you should, I think), or not.

If on branches:

From the current directory with HEAD in the right place (right being
what you want to diff against).

git checkout -b dev-branch-name
git add path/to/file
git commit -a -s
git diff original-branch-name > your-patch-file
git checkout original-branch-name
git branch -D dev-branch-name

If not on branches:

git add path/to/file
git commit -a -s
git diff HEAD^ > your-patch-file
git reset --hard HEAD^

Those are two ways I have used before, at least, there might others.

Thanks,
Nish

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux