How to use git with PhpStorm?

How to use git with PhpStorm?

October 20, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to use git with PhpStorm?

Understanding Git Workflow for Web Development Projects

Version control is an essential tool for any developer working on collaborative projects or looking to maintain a history of changes over time. In the world of web development, the most common versioning system used is Git.

Understanding the Basic Git Flow

At its core, Git allows you to keep track of different versions of your project’s source code. It records every change made to the files in your repository and lets you revert back to any previous state if needed. This is particularly useful when multiple developers are working on the same project simultaneously.

The basic Git workflow involves three stages:

  1. Cloning: You start by cloning a copy of the remote repository onto your local machine. This creates a local version of the project that you can work with.

    git clone <repository_url>
    
  2. Making Changes: In your local environment, you make changes to the files using your favorite IDE (like PhpStorm). These changes are known as “commits”.

  3. Pushing Changes: Once you’re happy with the changes, you can push them back up to the remote repository so that everyone else on the team has access to the updated code.

    git add .  # Stage all changes
    git commit -m "<your_message>"  # Commit with a message
    git push origin <branch_name>  # Push to the specified branch
    

Integrating Git with PhpStorm

PhpStorm is an excellent IDE that has built-in support for Git. This means you can perform all your version control operations directly from within the IDE without having to use the command line.

To start using Git in PhpStorm:

  1. Open your project.
  2. Go to “VCS” > “Enable Version Control Integration”.
  3. Select “Git” and follow the prompts to initialize a local repository or link an existing one.

Once set up, you’ll see version control information at the bottom of the editor window, including the status of each file (modified, added, etc.) and a Git log.

The Complete Development Cycle

Now, let’s address your question about the “live” site. Here’s how the complete cycle works:

  1. Local Development: You make changes to your project on your local machine using PhpStorm. This is where you do all your development work.

  2. Commit Changes: Once ready, commit these changes locally with a descriptive message.

  3. Push to Repository: Push these commits up to your remote repository (like BitBucket). This makes the changes available for the rest of the team or for deployment purposes.

    git push origin <branch_name>
    
  4. Pull from Repository: The live server pulls the latest version of your code from the repository using Git commands like git pull. This updates the files on the server to match what’s in the repo.

  5. Deployment: After pulling, the changes are deployed to the web server environment using a deployment tool (like Laravel Deployer or Capistrano for PHP projects). The exact process depends on your specific infrastructure and hosting setup.

  6. Going Live: Once deployed, the updated code is live and accessible by visitors on the internet.

Best Practices for Large Projects

If you’re working with large projects like Magento, it’s important to follow some best practices:

  • Use Branches: Instead of making changes directly in the main branch (usually called ‘master’ or ‘main’), create a new branch for each feature or bug fix. This keeps your development work isolated from what’s already live on production.

    git checkout -b <new-branch-name>
    
  • Merge Carefully: When you’re ready to include your changes in the main codebase, use git merge or git rebase carefully to avoid conflicts. PhpStorm has excellent tools for resolving merge conflicts graphically.

  • Use a Deployment Strategy: For large projects, consider using a deployment strategy that minimizes downtime and allows for easy rollbacks if needed (like blue-green deployments or A/B testing). Tools like Laravel Forge can help automate this process.

Conclusion

Understanding the Git workflow is key to effective version control in web development. By following these steps—cloning locally, making changes, committing, pushing, pulling, and deploying—you can keep your projects organized, track changes over time, and collaborate with others more efficiently.

Remember, the goal is to have a smooth process from local development to live deployment without any manual file transfers or risks of losing code. Proper version control using Git and tools like PhpStorm helps achieve this.

Please feel free to explore our resources at Laravel Company for more detailed tutorials on Laravel development, deployment strategies, and best practices in web development with PHP.

PHP

Our network