Child pages
  • Contributing code to PrestaShop

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Go to the PrestaShop GitHub repository.
  2. Fork the project by clicking on the "Fork" button. The fork will appear as a "PrestaShop" repository in your own account, with all the original branches.

    You've successfully forked the PrestaShop repository, but so far it only exists on your GitHub account. To be able to properly work on the project, you will need to clone it to your local machine.
  3. On your local machine:
    1. Clone your fork:
      1. Create a new folder on your local machine. We'll name it "PS-MyChanges", but you can use whatever name you want.
      2. Get the HTTPS clone URL from your GitHub PrestaShop repository. It should resemble this: https://github.com/your-username/PrestaShop.git
      3. Right-click on your PS-MyChanges folder, and in the Git section of the menu that appears, choose "Git Clone..."
      4. In the "Git clone" window that opens, paste the clone URL in the "URL" field and remove the final "\PrestaShop" mention in the "Directory" field, so that the files are downloaded at the root of the folder.
        Finally, do not forget to check the "Recursive" box so that you will also get all the default modules!
        Image Modified

        Note

        If you forgot to tick the "Recursive" checkbox when cloning your fork, use a command line terminal (shell, Bash, etc.) and enter these commands:

        git submodule init
        git submodule update

         

      5. Click OK: TortoiseGit will download the files and folders from your GitHub repo.
    2. (optional) Add the "upstream" remote: When a repository is cloned, it has a default remote repository called "origin" that should point to your fork on GitHub, not to the original PrestaShop repository from which it was forked. To keep track of the changes in the original repository and keep your local clone updated, you need to add another remote URL named "upstream":
      1. Right-click on the PrestaShop folder in the PS-MyChanges folder (it should have a green mark if no change has been made yet), and at the bottom of the TortoiseGit submenu, choose "Settings". This opens the Settings panel.
      2. Open the Git > Remote section of the Settings panel.
      3. Remote field: Type "upstream".
      4. URL field: put the HTTPS clone URL from the official PrestaShop GitHub repository: https://github.com/PrestaShop/PrestaShop.git .
      5. Click the "Add new/Save" button. TortoiseGit asks you if you want to disable tag fetching for this remote: choose "No", since this remote IS an official remote.
      6. TortoiseGit asks you if you want to fetch remote branches from the newly added remote: choose "Yes".
      7. TortoiseGit displays the Fetch window for PS-MyChanges: click "OK". A window will open showing that Git is fetching data. Close it once it is done, and close the still-open Settings window (which should by now list "upstream" below "origin" in the list of remote URLs).

...

  1. (optional) Fork the module's repository to your own GitHub account. For instance, fork https://github.com/PrestaShop/gridhtml to your own https://github.com/your-username/gridhtml.
  2. Add your fork as an 'origin' remote on the module's local folder:
    1. Go to your local modules directory (for instance, /PS-MyChange/modules).
    2. Open TortoiseGit's "Settings" window for the module's folder (for instance, /gridhtml's folder).
    3. Go to the Git > Remote section. You should already one registered remote URLs: "origin", pointing to the original repository for the module (for instance, https://github.com/PrestaShop/gridhtml.git).
    4. Crate an "upstream" remote, while keeping the URL as-is. Validate, and retrieve the branches.
    5. Create a new "origin" URL for your fork's URL. For instance, with gridhtml, that would be https://github.com/your-username/gridhtml.git.
    6. Validate.

...

The GitHub website has more information on how to fork a repo, how to use pull requests and many more articles on GitHub collaboration, but the best way to go is to advanced Git usage and managing Git remotes, but there are many ways to learn more about Git and GitHub:

...