In my development environment, my media/static files are slightly different to server environment. Different enough that if they are pushed live, it breaks my app.

I pushed them live by mistake - originally it pulled the server statics to my local environment. I fixed this.

Now I am trying to fix the server side, and here's where Git (to me at least) seems so....frustrating.

I can go on my server and type git checkout HASH. The hash returns me to the particular commit before I broke things. Great. My server is now back to where I'd like it.

What I'd now like to do, is keep it that way.

So I type:

> git checkout -b tmp
> git branch
..first
..master
..tmp
> git checkout tmp

If I now load my web app, the code isn't up to date (expected) but the big problem of all my static media files being deleted has gone away. Great. I have reverted my change. Now I want to merge that with my master...? I think?

git checkout master

Reload my webapp - it's now broken because of missing static media.

git merge tmp
..Already up to date

I reload the page - it's still broken. I've not reverted anything... ?

git checkout tmp

The page is working again.

How do I fix this? I have changes in my remote 'origin' repo which I'd like to merge with the app, but before I can do that I need to revert the deleted static files permanently. What do to?

0 Answers