---
title: "Using Git"
date: "2024-02-14T06:18:38+00:00"
summary: "Learn to use Git effectively for version control on Cloud Platform. Download clients, master basic commands, and follow best practices for branching, committing, and merging. Optimize your Drupal development workflow with proper code placement and repository management."
image:
type: "page"
url: "/acquia-cloud-platform/using-git"
id: "e1e16924-c721-4c0b-9729-338950c38603"
---

Table of contents will be added

Git is the version control system (VCS) available for use with Cloud Platform. The following information will help you use Git to manage your Cloud Platform code repository.

Note

Acquia does not provide support for third-party version control management tools.

Downloading a Git client
------------------------

You will need a Git client installed on your local system to work with your code repository.

To download a Git client, use the method based on your operating system:

*   _MacOS_: Use the [Git OS X Installer](https://sourceforge.net/projects/git-osx-installer/). If you use the [Homebrew package manager](https://brew.sh/), run `brew install git`.
*   _Windows_: Use [Git for Windows](https://gitforwindows.org/) (`msysgit`, command-line) or [TortoiseGit](https://tortoisegit.org/) (GUI).
*   _Ubuntu_: Use the command `sudo apt-get install git-core` to install Git using the command line. Follow the installation options on the [official Git website](https://git-scm.com/download).

Note

Ensure you [enable SSH access](/acquia-cloud-platform/manage-apps/command-line/ssh/getting-started) to your Cloud Platform environments.

Basic Git commands
------------------

You can find several basic Git commands, customized for your Cloud Platform application, in the Cloud Platform interface:

1.  [Sign in to the Cloud Platform user interface](/node/55875), and select your application.
2.  Select **Actions** > **View Git Information**.  
     

The **Git Information** panel displays basic Git commands for your application you can use to clone a repository, stage modified files, commit changes, and push local commits to a remote repository. You can click the copy icon to copy a command to your clipboard and then paste the command into an SSH session.

You can also find procedures to help you start with Git in [Checking out a local copy of your code](/acquia-cloud-platform/develop-apps/repository/checkout) and [Sending updates to your code repository](/acquia-cloud-platform/develop-apps/repository/github/update).

Git best practices
------------------

The following best practices apply to any application hosted in Cloud Platform, and can assist you in developing with Git:

*   [Creating a feature branch](#git-create-feature-branch)
*   [Committing branch changes](#git-commit-branch-changes)
*   [Merging your feature branches](#git-merge-feature-branch)
*   [Code placement in Drupal](#code-placement-drupal)

### Creating a feature branch

To create a branch for development work:

1.  Open a command prompt window, and then change the directory to the location that contains the [clone of your code repository](/site-factory/workflow/git#acsf-clone-repo).
2.  Switch to the master branch.
    
        git checkout master
        git pull origin master
    
3.  Create the feature branch with a name that describes the work the branch contains, and then switch to the new branch using the following commands, replacing `[feature_id]` with the name of your feature branch:
    
        git checkout -b [feature_id]
        git push origin [feature_id]
    

Create and use as many feature branches as needed to keep your development efforts separate from one another.

### Committing branch changes

Whenever you want to commit your changes back to the code repository for the branch you’re working on, run the following command to commit the change locally:

    git commit -a -m "Comment"

After you commit the change, send the change to the code repository (where `[feature_id]` is the name of your feature branch):

    git pull origin [feature_id]
    git push origin [feature_id]

When working with your code, if you must run a [Drush](https://www.drupal.org/project/drush) command that only affects one of your websites, ensure you use the `--uri=site.example.com` parameter, where `site.example.com` is your website’s complete website and domain name.

### Merging your feature branches

To merge your feature branches into a single release branch for testing:

1.  Create a release branch from your master branch. You will use the release branch for feature integration and testing. Use the following steps to create the branch:
    1.  Switch to the master branch.
        
            git checkout master
            git pull origin master
        
    2.  Create the release branch, and then switch to the new branch, using a command like the following.
        
            git checkout -b [release-candidate]
        
2.  Run the following command to ensure you have the most recent feature branch versions:
    
        git fetch all
    
3.  Merge each of the completed feature branches into your new release branch, using a command like the following:
    
        git merge [feature_id] --no-ff
    
4.  Push your release branch to the remote repository for testing.
    
        git push origin [release-candidate]
    

### Code placement in Drupal

As you develop each code branch, place code changes and additions in the folders appropriate for your version of Drupal. Placing your changes in other folders can cause serious problems for your repository, including merge conflicts Acquia cannot help you resolve.

### Current Drupal version

The [current Drupal version](/service-offerings/guide/software-life-cycle#supported-drupal-version) expects code changes in the following directories:

Directory

Suggested contents

`docroot/libraries`

Third-party libraries, such as WYSIWYG editors

`docroot/modules/custom`

Custom modules

`docroot/modules/contrib`

Modules from [Drupal.org](https://www.drupal.org/)

`docroot/profile`

Custom profiles

`docroot/themes`

 

### Drupal 7

Drupal 7 expects code changes in the following directories:

Directory

Suggested contents

`docroot/sites/all/modules`

 

`docroot/sites/all/modules/custom`

Custom modules

`docroot/sites/all/modules/contrib`

Modules from [Drupal.org](https://www.drupal.org/)

`docroot/sites/all/libraries`

Third-party libraries, such as WYSIWYG editors

`docroot/sites/all/themes`

 

`docroot/profiles`

Custom profiles

Additional resources
--------------------

For more information about how to use Git, see the following online resources:

*   [Git basics](/acquia-cloud-platform/help/92996-git-basics "Git Basics"): Acquia’s article on the basics of using Git.
*   [Resources for learning Git](/acquia-cloud-platform/help/92321-resources-learning-git "Resources for Learning Git"): Acquia’s article with a list of valuable tutorials and references.
*   [How to apply and test a patch from Drupal.org using Git on Cloud Platform](/acquia-cloud-platform/help/92576-how-apply-and-test-patch-drupalorg-using-git-acquia-cloud "How to apply and test a patch from drupal.org using Git on Acquia Cloud")