Update Drupal 9 core via composer on your local environment

Drupal
  1. Open the terminal app (or the terminal in VS Code) and change to the root site directory of the site you are updating
    cd [path/to/site/root/directory]
  2. Switch to the main branch and fetch the latest changes
    git checkout master
    git fetch --all
    git pull
  3. Create a new branch from the main branch for the Drupal core update
    git checkout -b update/core-[version]
  4. Update Drupal core (use the php that comes with XAMPP)
  5. composer update "drupal/core-*" --with-dependencies
  6. IMPORTANT! Check the release page if there has been changes made to the .htaccess file. Since most sites are customized, discard the changes to retain the current changes
    git checkout web/.htaccess
  7. Open your browser and login to the Drupal admin dashboard.
    URL: https://www.yoursite.com/user
  8. Navigate to yoursite.com/update.php and press the continue button
    URL: https://www.yoursite.com/update.php
  9. IMPORTANT! Check if there are database update. If there are database updates, make sure to backup the database first!
  10. Click the link to go back to the Administration pages and navigate to Report -> Status report page and make sure the site has updated correctly.
  11. Add and commit the changes and included a message with "Updated to [version]"
    git add .
    git commit -m "Updated Drupal core to [version]"
  12. Switch back to the master branch and merge the update branch to the main branch and push it to the repository.
    git checkout master
    git merge update/core-[version]
    git push

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.