Loading…
Close ×
Inquiry
×

Inquiry

Inquiry

Get A Free Quote

Let’s get to work! Contact us with the form below at no obligation to you. Together, we’ll set the project’s scope and demonstrate you value that the experts at cmsMinds bring to projects like yours.

Tell Us A Bit About Yourself

    Select As Many Of These As Apply

    How To Use GITHUB To Contribute To Drupal Core Or Module?

    Aug 2017 | by Jay

    Git is a leading version control system for software projects and Drupal.org uses Github for version control with it’s developers and Drupal community to build it’s core and contrib module. In this blog, I will share my experience on how to use Github to contribute code to Drupal.org.

    Drupal follows git’s branches and tags for managing code. Steps and naming conventions.

    How to use GITHUB to contribute

    For Drupal to release naming conventions for branch first time use below naming conventions.
    7.x-1.x (For Stable and dev)

    8.x-1.x (For Stable and dev)

    Below are not valid naming conventions:
    7.x-1.1 (For Stable and dev)

    8.x-1.1 (For Stable and dev)

    Below are valid naming conventions.
    unstable(deprecated)

    7.x-1.0-dev1 (For dev)

    8.x-1.0-dev1 (For dev)

    7.x-1.0-alpha1 (For alpha)

    8.x-1.0-alpha1 (For alpha)

    7.x-1.0-rc1 (For dev)

    8.x-1.0-rc1 (For dev)

    7.x-1.1 (For Stable)

    8.x-1.1 (For Stable)

    Below are not valid naming conventions.
    7.x-1.0-release1 (wrong word)

    7.x-1.0-rc (doesn’t end in a digit)

    7.x-1.0-UNSTABLE1 (uppercase)

    Install GIT on the system
    Configure GIT using below command
    git config user.email “yourmailid@mail.com”
    After the configuration, you can clone the project using GIT command. Example below:
    git clone –branch 8.4.x https://git.drupal.org/project/drupal.git
    Go into the project directory by below command
    cd drupal
    Now check git status (Show the working tree status and check the repository status.)
    To check branch under this project. We have to use command git branch (Show the branch and tracking info.)
    To get list of tags use git tag -l (Get list all Git tags)
    For adding a new branch use below command
    git checkout -b 8.x-1.x (First create the new branch and check it out)
    git push origin 8.x-1.x (Once the branch is created locally, it can be pushed up to the remote repository)
    git checkout 8.x-1.x (To work with this branch)
    For adding, a new tag use below command
    git tag 8.x-1.0 (First create the new tag)
    git push origin tag 8.x-1.0 (Once the branch is created locally, it can be pushed up to the remote repository)
    If you want to switch to a different branch, use below commands.
    git branch -a
    git checkout [branchname]
    Committing all changes locally using below commands.
    git add -A
    git commit -m “Issue #[issue number] by [comma-separated usernames]: [Short summary of the change].”
    Pushing the code back to the repository on Drupal.org
    git push -u origin [branchname]

    If you haven’t cloned the repository, follow the directions above for setting up this repository in the 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]

    For improvements, use the following command after making changes:

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

    For more complex improvements see the Advanced patch workflow.

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

    git apply -v [patchname.patch]

    To avoid accidentally including the patch file in future commits, remove it after applying patch to the directory.

    rm [patchname.patch]

    Revert changes to a specific file:

    git checkout [filename]

    Revert changes to the whole working tree: git reset –hard

    I hope the article give you the basic information on how to use GITHUB and contribute to the Drupal.org community. cmsMinds actively participates in Drupal community and has contrib modules it maintains. Please share your feedback and let us know if we can help you as custom Drupal development company in NC, USA.

    Top