Git Workflow - An Update

Now that Drupal have moved from CVS to the git versioning system, I realised that my github workflow can get even more of a workout and is doubly useful to me as I can now use it for Drupal contributions as well. The previous workflow is here: Github Workflow.

There are only a couple of differences between using Drupal's git and github.

  1. The url I will be cloning from and pushing to
  2. The fact that I more often that not be creating a patch to provide the issue queue.

Obviously this means that workflow will have to change slightly, so I'll do a new one here just for Drupal patches.

Step 0: Get the project information from
Go to the project ( you are planning on making a patch for and take a note of a couple of things. Right underneath the page title which should be the project name, you will find a link that says Git instructions follow that and then choose the version of the project you wil be updating. It should look similar to 7.x-1.x. That will update the page and give you your clone url.
Step 1. Setting up a local copy of the project (Do this first time only)
git clone --branch [version][project_name].git
Step 1a. If there is a branch saved to github - now redundant as the branch gets pulled and tracked during the clone
Step 2. Ensuring you have the latest code changes (Usual starting point)
git branch -a
git checkout [version]

git pull
Step 3. Create a safe place to work locally
git branch [local_branchName] - seem to be recommending that you use the issue number and a short description
Step 4. Move to the safe haven
git checkout [local_branchName]
Step 3&4 Combined. You can now combine steps 3&4 into one quicker step
git checkout -b [issue-number]-[short description]
Step 5. Do some work

Step 6. Log any new files created
git add .
Step 7. Log any changes to existing files
git commit -am "[Your comments]"
Again Drupal has some recommendations about comment formatting. It should be: "Issue #[issue number] by [comma-separated usernames]: [Short summary of the change]."
Step 8. Flip into the branch for the version you are working to
git checkout [version]
Step 9. Check the master records are up to date
git pull
git checkout [local_branchName]
Step 8&9 combined. Another different step to the original article that replaces the last 2 steps
git fetch origin
git rebase origin/[version]
Step 10. Do this only if new changes have been pulled through otherwise skip to Step 14.
Step 11. Bring the new changes into your local safe haven
git merge [version]
Step 12. Only If git reports any conflicts do this
git mergetool
git commit -am "[A new comment]"
Step 13. Go back to Step 8.
Step 14. It's at this point things get very different. For Drupal I will be mostly creating patches which I will then upload to
git diff origin/[version] > [description]-[issue-number]-[comment-number].patch
Step 15. Upload to the issue queue and mark the issue as "needs review"
Step 16. Remove your temporary workspace
git checkout [version]
git branch -d [local_branchName]


Just want to say your article is as astonishing.
The clearness in your put up is just cool and i can
assume you are a professional on this subject.
Well together with your permission let me to grab
your feed to keep up to date with imminent post.

Thank you a million and please carry on the enjoyable work.

Hello, just wanted to say, I enjoyed this blog post.
It was inspiring. Keep on posting!

That is really fascinating, You're an overly professional blogger. I've joined your rss feed and
stay up for in quest of more of your great post.
Additionally, I've shared your web site in my social networks

great ways to tell a story mate, thanks

Add new comment