Attempting to pull the files back in again after deleted does not work. No files show following the second pull.
Why does git not pull the files in again?
thanks
Attempting to pull the files back in again after deleted does not work. No files show following the second pull.
Why does git not pull the files in again?
thanks
Git doesn't again pull the file back in because you already pulled the files earlier and the local refs
are all up-to date already.
In fact, since you've made a commit after deleting the files, your local master branch should be ahead of origin by 1 commit (which should be visible if you do a git status
).
If you want your files back, you can use git reset
or git revert
like see other question, depending on your needs:
git reset --hard HEAD^
After running this, git pretends you never made the changes and created the commit. That's useful when you haven't yet pushed the commit back to the repository. If you accidentally drop a commit you actually needed, you can use git reflog
to find it.
git revert HEAD
This creates a new commit which reverts the changes of the commit in question. This is useful when you already pushed the bad commit and you cannot pretend it didn't happen.
Git has already pulled in the files. They don't show up because your current commit has deleted them. You can go back to the previous commit without reverting/resetting this one using checkout
command.
git checkout head^
Or you can checkout the upstream's commit as well:
git checkout blah/master
It will place you in a "detached HEAD" state. You can create a new branch out from that commit like so:
git checkout -b newbranch
You can always go back to the commit you made earlier by checking out master:
git checkout master