Skip to content

Instantly share code, notes, and snippets.

@ncuillery
Last active March 21, 2017 09:37
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncuillery/4b09e36d772601301cf0d0c94dcde692 to your computer and use it in GitHub Desktop.
Save ncuillery/4b09e36d772601301cf0d0c94dcde692 to your computer and use it in GitHub Desktop.
Upgrade React Native on your project, using a git-like interface
# In the root directory of a project, the Git working copy must be clean:
echo "a" | react-native upgrade # Generate the current version template and overwrite all files
git add .
git commit -m "Old version" # The current version template is added to the index
npm i react-native@latest --save # Install the new version of React Native
echo "a" | react-native upgrade # Generate the new version template and overwrite all files
git add .
git commit -m "New version" # Same as before, the new version template is added to the index
git diff HEAD~1 HEAD > upgrade.patch # Output the diff, totally suitable for the user's project
git reset HEAD~2 --hard # Go back to the source before the 2 upgrade commits
git apply upgrade.patch --3way # Git is able to perform a 3-way because the 3 versions of each files have an entry in the index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment