I trust that you found this blog post to be enjoyable. If you are interested in having my team handle your eCommerce setup and marketing for you, Contact Us Click here.

How to setup Git in Drupal

How to setup Git in Drupal

Setting up Git for a Drupal project involves several steps to initialize a repository, track changes, and collaborates with others. Git is a versionm control system that help you to keep on track of your computer programs and files and changes that are make to them over times.

Git also allow you to collaborate with your peers on a program, code or file. Github and similar services are websites that host a git server program to hold your code.

What is Git and Why do we need it?

Software development is challenging. It involves working with several files and other require tinkering with the source code to achieve the intented output before it’s ready to use.

Some of the notible benefits of using a version control system include:

  • Access to long term changes history so you can view every changes that’s ever been made to a file by the team.
  • Branching and merging, which facilitates simultaneous coontribution.
  • It allow you to merge multiple version of a file into a single file to apply the changes and prevent file duplication.

Step 1: Create Github Account.

  • Go to the Google tab and search github login.
  • Then Sign in to the github.
    ptiwebtech_website


  • After click on Sign-in to Github.
  • Login or create a github account.
    ptiwebtech_website


Step 2: After Signup the Github account.

  • Enter the Username or email address.
  • Enter the Password.
  • Then click on Sign up for Github.
    ptiwebtech_website
  • Click on “+” sign.
  • Click on New Repository.

Step 3: Create a New Repository.

  • Select a new repository.
  • Enter a name for your Repository.
  • Create Repository.
    ptiwebtech_website
  • Set-up your first repo on Github.com.

Step 4: Create a File.

  • Your repo file is created.
  • Go to the command line and hit the commands one by one.
  • Create a new repository on the command line.
    ptiwebtech_website


  • After using these command your repository is ready.

Step 5: Push and exiting Repository from the command line.

ptiwebtech_website

Step 6: Import Code from other Repository.

  • To initialize this repository with code.
    ptiwebtech_website

Step 7: Initialize the Git Repository.

  • Open your Terminal or command prompt.
  • Navigate to your Drupal project Director
    ptiwebtech_website

Step 8: Initialize a new Git Repository in the Directory.

ptiwebtech_website

Step 9: Create a “.gitignore” File.

  • Create a ‘.gitignore’ file in your project directory.
  • You can start with a basic ‘.gitignore’ file that excludes common drupal files and directory.
ptiwebtech_website

Step 10: Add files to Git.

  • Add all the files in your Drupal project to Git.
    ptiwebtech_website

Step 11: Commit changes

  • Commit the added files to the Git Repository.
ptiwebtech_website

Step 12: Create and Add Remote Repository ( Optional ).

  • Use a remote Git Repository for Backup and version control.
  • Create a Repository on a Git hosting service.
  • Add it as a remote to your local Git Repository.
    ptiwebtech_website
  • Push Changes to Remote Repository.
    ptiwebtech_website
  • Setup Branches (optional)
    ptiwebtech_website
  • Pull changes from Remote Repository (optional).
    ptiwebtech_website
Back to blog