User Tools

Site Tools


how_to_adapt_to_git

How To Adapt To Git

If you started modifying your platform's core files and don't want to use vQmod for soft modifying it. Then you probably think upgrading the platform is hundreds of hours of work. That does not need to be the case.

Adapt your current platform to Git for easily pulling future updates. In this example we are using BitBucket for the private repository. Here is what to do:

1. Sign in to your favourite Git repository hosting service (e.g. GitHub or BitBucket) and create a new Git repository.

2. Substitute your LiteCart project folder with a new empty folder:

3. Use your Git Bash to initialize your Git project and configure it for repositories. (We are assuming you have Git installed on your computer e.g. https://tortoisegit.org/download/)

# Navigate to an empty project folder
# For Windows do: cd "C:\path\to\myproject\"
cd "/path/to/myproject/"

# Make this directory a Git project
git init

# Add your private or public Github or Bitbucket repository as "origin"
git remote add origin https://yourusername@github.com/yourusername/yourrepo.git

# Add LiteCart's repository as "litecart"
git remote add litecart https://github.com/litecart/litecart.git

# Retrieve information about the remote LiteCart repository
git fetch litecart

# Revert back to a certain version number (stated by it's tagname) e.g. 2.1.6. For the very latest commit simply ommit the version.
git reset --hard 2.1.6

# Push all your content to your new repository's main branch named master. Make it the default upstream (if you don't specify a different destination when pushing commits).
git push --set-upstream origin master

# Copy your modified LiteCart platform into your project folder. Replace all existing files.
# For Windows do: xcopy "C:\path\to\your\litecart\folder" "C:\path\to\myproject\" /E/H
cp -R "/path/to/your/litecart/folder" "/path/to/myproject/"

# Show all changes
git status

# Commit all changes
git commit -m "My big initial commit"

# Push your commit(s) to your repository named origin that has a branch named master.
git push origin master

5. Now begins the fun. Pull all updates from Github.

# Pull all updates from the Github repository we called litecart
git pull litecart

6. Solve any merge conflicts. (This guide will not teach you how to solve conflicts. But we recommend using TortoiseGit Resolve)

7. Use your browser to navigate to the installation folder and run the upgrade script. This will perform all changes necessary to update files and database.

 http://localhost/install/upgrade.php

8. After the upgrade, make sure your platform is running fine. Use your web browser to access it:

 http://localhost/

9. Finally commit all changes and push them to your repository:

# Commit all changes
git commit -m "My commit message"

# Push commit to repository
git push origin master

11. All done! You should now be running the latest update of LiteCart merged with all your modifications.

Now you can use Git to commit all your new features and updates. Next time you want to pull an update, go back to step 5.

Sourcetree is a great GUI tool for playing with your Git projects. It's awesome, just like LiteCart! ;)

how_to_adapt_to_git.txt · Last modified: 2021/01/14 03:44 by tim