GIT: How to checkout a module and create a patch

From Wowww mediawiki

Jump to: navigation, search

This page explains how to use GIT when creating a patch for a module.
If you already checked out the project, proceed with step 5.

  1. Checkout the latest version from a specified branch
    cd [dir where you want to checkout]
    git clone[modulename].git --branch [branchname]
    # e.g.: git clone --branch 6.x-2.x
  2. Check available branches
    git branch -a
  3. Check current branch
    git branch
  4. Update existing checkout
    git pull[projectname].git [branch]
    # eg:git pull 6.x-2.x
  5. After verifying you checked out the correct branch, make modifications to it and then make a diff.
    There are 2 ways creating a diff, depending if there are new files or only changed files.
    • Create a diff with only modifications to files
      git diff > [description]-[ issuenumber]-[ comment number].patch
      #eg: git diff > ubercart_review_order-1336226-3.patch
    • Create a diff with new added files
      git add []
      git diff --staged > [description]-[ issuenumber]-[ comment number].patch

Attach this patch to a issue comment

Personal tools