May we use git with a Drupal Site ?

Because I'm trying to use Git with a Drupal site and it seems that not all the information that are pushed !!!

Thank you

  • Did someone set up the .gitignore file? It might be ignoring some files, but that might be a good thing. Most people don't want to shove Drupal core into the repo. Commented Jul 13, 2016 at 20:01
  • The .gitignore files are empty ... yeah it will be a very good thing -- I hope that it is possible!!
    – taboubim
    Commented Jul 13, 2016 at 20:04
  • You're not trying to push website content with git, right? Just the code?
    – beth
    Commented Jul 13, 2016 at 20:08
  • all the things, code and content ? is it possible ?
    – taboubim
    Commented Jul 13, 2016 at 20:11

2 Answers 2


Git is a source code management (SCM) system. There are many different source code management systems out there and Git fall into the category of a distributed version control system (DVCS). It takes a "peer-to-peer" approach to version control as opposed to a "Client-Server" approach like version control systems like Subversion (SVN).

Yes we can use GIT with drupal.

To setup a GIT repository in drupal project please visit below link.

Git Setup


Yes. It is typical practice to manage Drupal with a VCS, with Git being the defacto option; Drupal core, as well as all projects on drupal.org, uses Git as its VCS.

Drupal includes some default git configurations. D7 has a default .gitignore config. D8 has an example.gitignore config which isn't applied by default. There is also a default .gitattributes for white space settings.

You'll have to troubleshoot what is/is not include in your codebase. Typically, the gitignore settings exclude content & settings data from the code repo.

  • Oh !! where may I find the default drupal gitignore file ?? because this one is blocking the content to be updated !
    – taboubim
    Commented Jul 13, 2016 at 20:07
  • 1
    It's in the site root. BTW, using a VCS to store content is considered bad practice; a VCS is for managing code, not data. Putting all your content into your VCS can blow up its size pretty quickly depending on how much content you have.
    – Shawn Conn
    Commented Jul 13, 2016 at 20:10
  • So for the content I use "export and import" the database ?
    – taboubim
    Commented Jul 13, 2016 at 20:11
  • There are many solutions out there, it will depend on your needs. The Drupal Backup and Migrate project is one solution to migrating over both DB & file system content.
    – Shawn Conn
    Commented Jul 13, 2016 at 21:17
  • @ShawnConn my naive way of handling it was creating a separate repo and doing mysqldump, after i clear cache of course.
    – Daedalus
    Commented Jul 13, 2016 at 23:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.