Skip to content

react-native-git-upgrade deletes my non-versioned files and fails #12237

Closed

Description

@antoinerousseau

Description

I installed react-native-git-upgrade@0.2.5 and ran it on my project.

Reproduction

$ react-native-git-upgrade
git-upgrade info Check for updates
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.41.2, React ~15.4.0
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
git-upgrade info Commit old version template
git-upgrade info Install the new version
npm WARN deprecated node-uuid@1.4.7: use uuid module instead
git-upgrade info Generate new version template
git-upgrade info Add updated files to commit
git-upgrade info Commit new version template
git-upgrade info Generate the patch between the 2 versions
git-upgrade info Save the patch in temp directory
git-upgrade info Reset the 2 temporary commits
git-upgrade info Apply the patch
fatal: unrecognized input
git-upgrade WARN The upgrade process succeeded but there might be conflicts to be resolved. See above for the list of files that have merge conflicts.
git-upgrade info Upgrade done
$

And in the end, no file is modified, and some files are missing, for example android/app/google-services.json (present in my .gitignore)

Solution

No idea

Additional Information

  • React Native version: just installed 0.41.2, wanted to upgrade RN templates according to it
  • Platform: n/a
  • Operating System: macOS

Note: my Android/iOS package name is net.tribeez (my package.json name is tribeez)

Activity

  1. ncuillery commented on Feb 6, 2017

    @ncuillery
    Contributor

    Ok I reproduced the deletion by running the Git commands manually, just like the tool does: https://gist.github.com/ncuillery/4b09e36d772601301cf0d0c94dcde692. I think I got it:

    The first step of the process consists in restoring the template of your current RN version, just like it would have been generated by the init command. So your .gitignore file is replaced by this one https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/_gitignore for the rest of the process.

    From now on, android/app/google-services.json is no longer ignored. So when the files are committed, it is considered as "added".

    At the end, the git reset --hard command reverts the commit and logically deletes the file 😱

  2. koenpunt commented on Apr 3, 2017

    @koenpunt
    Contributor

    .env files also disappear, which I'm not happy about...

  3. jwarby commented on Apr 5, 2017

    @jwarby

    Also lost some files which were .gitignore'd after using the upgrade tool... 😞

  4. rdixonbhw commented on Jun 1, 2017

    @rdixonbhw

    I'm assuming the files it obliterates are just as gone as if I'd run rm on them? If so that's a pretty significant setback for me.

  5. hehex9 commented on Jun 8, 2017

    @hehex9

    react-native-git-upgrade deletes my jks file.
    I just *****

  6. didil commented on Jun 9, 2017

    @didil

    same , some gitignored files get deleted and I have to find them in my backups, pretty annoying if you dont expect it ...

  7. joncursi commented on Jul 13, 2017

    @joncursi
    Contributor

    Ditto. I use react-native-config to store environment variables for development, staging, and production. Git upgrade wipes out these files since they are not committed to github (contain secrets). Pain in the butt to have to replace them every month when a new RN version comes out.

  8. rdixonbhw commented on Jul 13, 2017

    @rdixonbhw

    I've started using rn-diff for upgrades, usually pretty quick and less frustrating to do it manually. https://github.com/ncuillery/rn-diff

  9. ujwal-setlur commented on Aug 3, 2017

    @ujwal-setlur

    This is driving me nuts too! Every time I upgrade, my .env files and frameworks under ios/Frameworks are deleted (stuff under Frameworks is gitignore'd). First time build always fails before I remember to restore from backup...

    Will check out https://github.com/ncuillery/rn-diff

  10. Robo-Rin commented on Oct 3, 2017

    @Robo-Rin

    Any update on this? Did you all end up switching to rn-diff?

  11. antoinerousseau commented on Oct 3, 2017

    @antoinerousseau
    ContributorAuthor

    @Hauuguu I did, yes

  12. MrToph commented on Nov 12, 2017

    @MrToph

    Same here, just lost all my files that were gitignored ...

  13. stale commented on Jan 11, 2018

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

  14. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Jan 11, 2018
  15. joeybaker commented on Jan 11, 2018

    @joeybaker
    Contributor

    This is very much still happening to everyone who uses react-native-git-upgrade and uses a .gitignore.

  16. removed
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Jan 11, 2018
  17. ujwal-setlur commented on Jan 11, 2018

    @ujwal-setlur

    I stopped using react-native-git-upgrade in favor of rn-diff

  18. antoinerousseau commented on Mar 9, 2018

    @antoinerousseau
    ContributorAuthor

    Looks like 7492860 resolved this.

  19. locked as resolved and limited conversation to collaborators on Dec 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions