Coder Social home page Coder Social logo

template-sync's Introduction

Template Sync

You started a project from a template repository but the template changed since you started the project? Template Sync will import the changes made to the template to your project in a blink!

Getting Started

curl -sSL https://raw.githubusercontent.com/coopTilleuls/template-sync/main/template-sync.sh | sh -s -- <url-of-the-template>

If you have some conflicts, resolve them and run git cherry-pick --continue.

Supported Templates

How it works

This script identifies a commit in the template history which is the closest one to your project. Then it squashes all the updates into a commit which will be cherry-picked on the top of your working branch. Therefore you just have to resolve conflicts and work is done!

Monorepo containing multiple templates

Using this kind of templates, you have to specify the subdirectory where your template is with the --directory flag.

For example, assume you work on a project base on the template "api-routes" from next starters. The main monorepo is vercel/next.js and the template is located in examples/api-routes :

curl -sSL https://raw.githubusercontent.com/coopTilleuls/template-sync/main/template-sync.sh | sh -s -- https://github.com/vercel/next.js --directory=examples/api-routes

Advanced

  1. Go to your project repository (we recommend to create a new branch) Copy template-sync.sh at the root of your project

  2. The only mandatory argument is the GitHub or GitLab URL of your template but if you want to synchronize your project with a specific version of the template, you can specify the commit you are targeting by adding --commit=<commit SHA>. E.g. Assume your project is based on dunglas/symfony-docker and you just want to get the improvements of the new php app server FrankenPHP. Run this command :

curl -sSL https://raw.githubusercontent.com/coopTilleuls/template-sync/main/template-sync.sh | sh -s -- https://github.com/dunglas/symfony-docker --commit=88f5c19
  1. In case some files are renamed or moved in the template history, you can modify the threshold where git considers two files as identical. Default value for this script is 20% (git's default value is 50%). If git is confused and considers files that are not identical to be identical, you can raise this threshold. E.g:
curl -sSL https://raw.githubusercontent.com/coopTilleuls/template-sync/main/template-sync.sh | sh -s -- <url-of-the-template> --threshold=30
  1. You can run the script in debug mode by adding the --debug flag.

  2. If for any reason you are not satisfied with the result of the script you just have to run git cherry-pick --abort to rollback before the execution of the script.

Created by Emmanuel Barat and Raphael Marchese

template-sync's People

Contributors

laryjulien avatar mano-lis avatar raphael-marchese avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

laryjulien

template-sync's Issues

Validating commit

Display infos on the base commit for the merge:

  • SHA
  • Date
  • Message

And ask for user validation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.