I’ve read about git clean and git reset but I don’t think they do what I need. I tried git pull but it didn’t fix the issue (git pull results in: Already up-to-date.)
My remote repo at github is fine.
I just copied all my rails projects from my old PC to my new Mac which also has a working rails dev environment.
Everything else moved fine, but somehow, a lot of my db/migration files are missing locally. (No idea why… nothing else is missing.)
When I cd into the directory and run git status I see the same thing:
# On branch master
# Changes not staged for commit:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: db/migrate/20110330064532_init_user_guids.rb
# deleted: db/migrate/20110330065055_init_master_report_key.rb
# deleted: db/migrate/20110331001956_create_recurly_accts.rb
Anyway, I am looking for the command that will pull all the missing (not staged + deleted) files from the remote (origin) to local, without removing any of the untracked files locally such as my sqlite database.
Or maybe a git command that restores them from my local git repo, since the deletions are “unstaged”?
(I should add that I have no other unstaged changes… just those missing files I need to replace.)
If the only changes are the missing files, you can just use
git reset --hard HEAD, and that will restore everything back to the pristine state. However, it will not delete any untracked files (you needgit cleanfor that). So this should be safe to run, as it will restore your missing files, but leave your untracked database alone.