Skip to content

Recommended Steps for Merging Starter into Existing Project

Anthony edited this page Dec 19, 2016 · 9 revisions

1. Create a new branch

git checkout -b merge-with-starter

2. Add this starter as a remote source

git remote add starter https://github.com/qdouble/angular2webpack2-starter.git

3. Fetch Starter repo

git fetch starter

4. Merge with starter project

git merge starter/master --allow-unrelated-histories

5. Add files that can’t be accessed

git add *  
git add .gitignore

6. Carefully examine merged files for conflicts

Original files will be under


<<<<<<< HEAD
=======


Files from starter will be within

=======

=======
>>>>>>> starter/master

You generally want to copy the stuff that you want to keep from the HEAD section and paste it into the starter/master section and then delete the HEAD section. Keep or move entries that you want to keep, delete stuff that’s not needed and save changes.

7. Set main app module imports

Make sure to move main app module declarations, imports, and providers to APP_DECLARATIONS, APP_IMPORTS and APP_PROVIDERS files in src/app folder. Also make sure your main app component is declared and bootstrapped in src/app/app.module file. Also make sure your main app components selector matches the one in src/index.html

8. Stage the files you have fixed

git add *  
git add .gitignore



9. Clear and install packages

delete node_modules folder and then run npm install

10. Test application and fix issues

Try to run app in different modes (development/production, JIT, AOT, Universal*)), run tests and resolve any issues.

11. Cleanup and remove any files that are no longer needed and rerun tests

12. Save changes and commit

git add *  
git commit
:wq

13. Merge your updated app into master or send pull request

To merge:

git checkout master
git merge merge-with-starter

To send pull request, push branch:

git push https://github.com/USERNAME/PROJECT_NAME merge-with-starter

Then make pull request on GitHub client application or directly on GitHub website

14. Enjoy your updated app 😄

*If you’re using Universal and have routes with html5pushstate, be sure to add the main routes for Universal to use in the ‘src/server.routes’ file.