PoolByte

Website version control with Git: Commits, deployment and rollback

· PoolByte Technology

Website version control with Git: Commits, deployment and rollback

Git version control helps keep track of changes made to a web project's files. When the folders named “last”, “last2” and “real-last” become larger, it becomes difficult to understand which edit was made live. Version control provides a more organized basis for tracking the content and intent of the change together. However, it does not automatically backup the live database or customer installations.

Determine what will be monitored in the project

Source code, theme files, templates, and developer-managed configuration samples can be included in version control. Passwords, API keys, exports containing personal data, and live environment secrets should be kept separate. Adding large user uploads or database backups to the code repository is a false start for most web projects.

Git's version control description addresses logging of file changes over time. Set up this registration according to the scope of work. Instead of just telling the design agency "We're using Git," it should be clear which files are in the repository, which account owns it, and how the business will get access rights upon delivery.

Create small and clear change records

A commit should cover as much of a single clear purpose as possible. Comments like “Fix mobile overflow in menu” or “Add variant validation to product form” are more helpful than saying “update.” Putting ten independent edits into a single record can make it difficult to retrieve and review just one later.

An example team flow could be set up like this: the developer opens a branch for the task, completes his change with minor commits, someone else reviews the diff and merges it to the master branch after appropriate checks. The process may be simpler depending on the team size. The important thing is not to leave any uncertainty about what the change was to the living thing and what control was made.

Separate secrets before they enter storage

.gitignore can be used to prevent eligible files from being monitored; It does not automatically clear the previously viewed file from the history. See gitignore doc for details. Even if the name of the file is "private", the content may have been added to the repository by mistake. It is necessary to review the change list before each save.

If a key is in the repository, simply deleting it from the last file should not be considered sufficient. The authorized person must renew the relevant access and evaluate historical visibility. Historical logs and sample configurations should also be checked before making the repository public. Exposing the code repository to the web server's publicly accessible directory can also be a separate publishing error.

Associate live version with commit

The last commit of the code repository and the live site may not be the same version. A small fix made manually on the live server may be lost in subsequent deployment if it is not committed to the repository. Record the version tag or commit ID of the released package. This information does not have to be a clear display to the customer; It is sufficient for the business to be in the operation record.

In projects that require compilation, the source code and the published files are different. The working environment used, dependency lock file and compilation command must be included in the delivery document. The ability to produce packages again from the same source version is an important convenience during maintenance. The “we download the files from the server and continue” approach does not replace this information.

Separate rollback from data recovery

It may be possible to revert an interface change to the previous version; But if the database schema has changed, the old code may not be compatible with the new data. Consider the fallback steps for code, data migration, and user files together. Replacing live order data with old backup may result in loss of new transactions.

Let the return record include the triggering situation, the code version to be used, data compatibility and validation scenario. Remember that a version checked in the test environment may work with different settings in the live environment. Having git history does not automatically make an unchecked rollback safe.

Information to be requested during project delivery

  1. Business access and authorization scheme of the code repository.
  2. The tag or record ID of the version that went live.
  3. Description of installation and compilation steps.
  4. In which environment the secrets are kept; actual values ​​should not be available in the open document.
  5. Database migrations and fallback conditions.
  6. Maintainer and change approval process.

You can pass these delivery expectations to PoolByte in your new web project. You can refer to staging guide for pre-live trials, and SFTP guide for transferring version files. Using these tools together helps you establish a recorded, reviewable maintenance pattern.