I have an angular application which was earlier running on Angular 8.2 . I upgraded the code using a particular branch to Angular v13. Now there were some additional changes made in other branches, which are on v8.2 . I want to pull the code running on older version of Angular into my branch and migrate it to Angular 13. How can I merge code belonging to different versions and upgrade the code running on an older version to the latest version?
-
I recommend you to learn some git basics. For example, this book - https://git-scm.com/book/en/v2 – leonmain Jan 30 '22 at 17:57
1 Answers
it's seems some related also to git other than Angular.
You have some different approaches that you can use to achieve your goal:
do a cherry pick from branch with old angular version to branch with branch with the last updated angular version, using only the commits that includes the additional changes (this way is the fastest way, because includes only additional change without touch node_modules and package-lock.json)
other option is to do a git checkout branch with old angular version, then a git pull. After do this you need to do a git checkout on branch with new angular version and then do a git rebase old-angular-branch inside it. This git command make a cherry pick per every commit that differentiates two branch, for every rebase you'll solve the conflicts till you'll going to have the last updated version that includes the additional changes
last option is quite equal to the previous ones: after checkout and pull from old-angular-branch, you need to checkout the new-angular-branch and the do git merge old- angular-branch. This merge all differences from the first branch inside the new-angular-branch, this operation will create a bunch of conflict (I image), but after you can delete node_modules and package-lock.json, and after do npm install and recreate node_modules and package-lock.json. You'll have the additional changes merged in new angular branch without any conflicts.
My preferred choice is the cherry pick way, but also the lattest should work quite fastly and easy.

- 369
- 2
- 7