We talked in IRC last night about how, given that we're using 'git diff', most of the current patching process in Git instructions is unnecessary for basic changes. webchick, marvil07 and I worked on the following update. We weren't quite done, but I want to capture where we were when we quit for the night:

Creating a patch

For most improvements, use the following after making your changes:

git diff > [description]-[issue-number]-[comment-number].patch

For more complex improvements that require adding/removing files, work over the course of multiple day , or collaboration with others, see the more advanced patch workflow

Note: we'll need to work on the advanced workflow at the same time we consider updating the instructions.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eliza411’s picture

After a little more work, we're closer to:

Getting ready to create or apply patches:

If you have not already cloned the repository, follow the directions above for setting up this repository in your local environment. Be sure you are on the branch you wish to patch, then ensure it is up-to-date with the following command:

git pull origin %branchname

Creating a patch

For most improvements, use the following command after making your changes:

git diff >  [description]-[issue-number]-[comment-number].patch

For more complex improvements that require adding/removing files, work over the course of multiple days, or collaboration with others, see the advanced patch workflow.

Applying a patch

Download the patch to your working directory. Apply the patch with the following command:

git apply -v [patch.name]

To avoid accidentally including the patch file in future commits, remove it:

rm  [patch.name]

See Applying Patches for more detail.

When you're done: Reverting uncommited changes

Revert changes to a specific file:

git checkout [filename]

Revert changes to the whole working tree:

git reset --hard
eliza411’s picture

Assigned: Unassigned » eliza411

We're going to go forward with this change as soon as the patch documentation is cleaned up as well.

rfay’s picture

Yep, works for me.

Maybe instead of [patch.name]
use [patchname.patch]

eporama’s picture

Just one comment from someone who is trying to follow the right path ;-)

The Git instructions for a project say the recommended naming is:

[description]-[issue-number]-[comment-number].patch

Whereas the Patch contributor guide says the issue number should be first:

[issue-number]-[description]-[comment-number].patch

IRC comment from ksenzee: "It's obviously easier to change the handbook than it is to change the git instructions, but personally I agree with the handbook." I think the issue number first is also a better idea, but don't have any idea what it would take to change the automatic "Git instrucitons".

eliza411’s picture

Status: Active » Closed (duplicate)
eliza411’s picture

Actually, I should elaborate as this is a clear request. There is no community consensus on the format and we're asked to change this on a regular basis, but not asked to change it to the same thing. What's in Git instructions represents the recommendation of the Git team. I run changes by rfay, webchick, and sdboyer at a minimum. If a g.d.o. discussion leads to a clear standard, I am happy to make the adjustment. Of course, that won't stop the docs from changing when people disagree.

eliza411’s picture

Status: Closed (duplicate) » Active
eliza411’s picture

Status: Active » Needs review
FileSize
22.83 KB

This month's update

eliza411’s picture

Project: Git on Drupal.org » Project Git instructions
Version: » 6.x-1.x-dev

Moving to Project Git instructions

eliza411’s picture

Status: Needs review » Needs work

I diffed that patch wrong. Working on re-rolling.

eliza411’s picture

Status: Needs work » Needs review
FileSize
20.69 KB

This should be better. I also isolated the patch to this issue only.

eliza411’s picture

Try this one more time. One set of instructions got missed.

eliza411’s picture

I made the update to the database this morning.

jami’s picture

Hi all. Thanks for all the hard work on Git and this module -- it's a life-saver for a Git n00b like me.

I'm sure these patch instructions will be useful when I start patching issues, but I noticed that some of the old instructions are gone.

For me (again, Git n00b), it was helpful to have instructions on how to commit my changes locally (git add -u, git commit -m) and "Tag for a stable release."

It's possible the old instructions were removed for a good reason I'm unaware of (probably better to work through the issue queue/patches...?). But if you do need to make a new release, the instructions for that were very helpful.

My two cents, and thanks again for all your hard work!

jami’s picture

Aaargh. When I logged in to post my question, I began to have a sneaking suspicion I'd have different instructions when I went back to my project page logged in. Sure enough, there were the local commit and tag instructions.

Sorry for the false alarm!

eliza411’s picture

Status: Needs review » Fixed

Marking fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.