#What to commit to git when switching environments in Gen 1?

2 messages · Page 1 of 1 (latest)

hybrid crag
#

My amplify project is quite long lived (4+ years) and an early adopter so I'm trying to update my mental model a little to correct any bad habits/coping strategies I've picked up over the years. This is one I still don't have confidence in so would love some guidance.

I have two branches in my repos for live (main) and dev. I develop in dev and merge into live to push up and let the CI do its thing. I've a live and dev environment setup within Amplify, this has all been working as is for years.

Sometimes we need to work with live data on the dev branch to try to debug an issue so I'll run amplify env checkout live and switch the working environment that my dev code is using. This works just find but when doing so git tells me I have 2-3 files that need commiting:

amplify/team-provider-info.json```

I once committed the dev one into live and broke everything and since then I've been terrified of doing it again so I've just learnt to switch back to the matching environment, discard any changes and keep going. This has worked but of late I'm starting to think that this isn't right so I'd love to know what is the correct way to do this. 

I think it should work like this: when I switch to the live environment I assume it pulls down the live config which I think I should be safe to commit into the live branch (but not the dev one) and visa versa. A switch is like a pull I'm guessing but we never do those either due muscle memory of breaking things in the early days of Amplify. If I do switch envirnoments then I should always switch back to the correct one for the branch I'm in. 

Can someone confirm on the right way to do this with out blowing anything up?
soft flame
#

You're on the right track with your approach to managing environments in AWS Amplify.