← Back to Projects

Part 2: Version Control

Tracking codebase changes and connecting the project to a public GitHub repository.

Version control is essential for any professional project. It allows you to safely track changes, revert mistakes, and sync your code seamlessly between your local computer and the cloud server. This project leverages Git.

1. Initializing the Repository

Navigate to the project directory in your terminal and initialize a completely new git repository.

git init

It is important to create a .gitignore file to prevent sensitive files (like database credentials inside config.php or the actual database structure .sql) from being accidentally uploaded to a public hub.

echo "config.php" >> .gitignore

2. Committing the Codebase

With the gitignore protecting sensitive data, add all of your HTML, CSS, Javascript, and PHP files to the staging area and commit them.

Screenshot of the VSCode terminal showing the successful output of a git commit.

Placeholder: Take a screenshot of the terminal committing files locally.

git add .
git commit -m "Initial commit of website codebase"

3. Pushing to GitHub (or GitLab)

Create a new repository on your GitHub account. Then, link your local codebase to that remote repository and push your commit to the cloud.

Screenshot of the GitHub web dashboard showing the uploaded code files.

Placeholder: Take a screenshot of your GitHub repository populated with the project files.