Chords
Chords

Reputation: 6850

Delete live site and pull in new code from repo

I have a local development environment and a live server. On that same server in my home directory I have a git repository. To date I've been moving files over, one at a time, via FTP. Yuck.

When I SSH to the server and issue the pull request I get a bunch of merge conflicts. Since I know what I committed and pushed to the repo is only and all of what I want, is there a way to wipe out what's currently on the production server and pull in everything from the repo?

I don't care about any old commit history, etc - I'm just hoping for a way to do this with limited, or hopefully no downtime. Thanks!

Upvotes: 0

Views: 48

Answers (2)

CharlesB
CharlesB

Reputation: 90406

On the live server do

git reset --hard master

This will reset to last good pushed state.

To reset to state of your remote repo use origin/master instead of master.

Upvotes: 0

ogzd
ogzd

Reputation: 5692

git fetch --all
git reset --hard origin/master

But be careful that this will overwrite your local files in production server.

Upvotes: 2

Related Questions