jmadsen
jmadsen

Reputation: 3675

git update remote server after repo rollback

was working on master when should have been on a branch, so I made a branch & then rolled back to the last good commit with:

git reset --hard <commit_id>

I then pushed master with:

git push origin master -f

This leaves my repo in correct condition - I can see it is all correct on my gitlab page & when I pull locally it is correctly up-to-date

I have a development server that is currently on branch "master" & I am now trying to "pull the reset" for lack of the correct expression - set it back to where my local machine is. However, any fetches or pulls all result in it telling me that I'm already up-to-date

From dev server git branch -a

* master
  remotes/origin/master

What is the correct procedure here?

TIA

Upvotes: 0

Views: 71

Answers (1)

Alexander Yancharuk
Alexander Yancharuk

Reputation: 14531

Try to complete delete your master branch on development server and than clean checkout:

# Make master backup    
git checkout master && git checkout -b old-master

# Delete your local master
git branch -D master

# Checkout master from origin
git checkout master

# In case something is wrong - restore backup
git branch -D master && git branch -m old-master master

# If all is ok delete backup
git branch -D old-master

Upvotes: 1

Related Questions