Pablo Viacheslav
Pablo Viacheslav

Reputation: 963

Pulling a Git repository brings different files

We are working in a project which code is hosted in Github. At some point the main branch master had to be rolled back to a certain commit. We did that by locally rolling back to the commit, then forcing a push to the remote.

That seemed to work well, and checking directly in Github shows that the files were all rolledback, and the folders expected to dissapear did, which is correct.

Then I deleted my local master in order to fetch the new one. I did so by running:

git checkout someotherbranch
git branch -D master
git fetch --all
git checkout master

Some files actually seem correct, that is rolled back to the specified commit, however some folders with the files inside remain there. Also some other file, an HTML file, didn't correctly rolled back.

Is there any step I am missing?

Upvotes: 0

Views: 23

Answers (1)

Pablo Viacheslav
Pablo Viacheslav

Reputation: 963

I was actually missing one step:

git reset --hard

So the unwanted local files would be gone and make the local branch perfectly match the remote one

Upvotes: 1

Related Questions