Ad
How To Recover All Deleted Local Files Which Were Deleted Using Command (Git Checkout ...)?
I had a project which I wanted to push to Git. So I create a local repo (git init
). I had a .gitignore
in remote repo so I couldn't push my local files to remote. So I did git checkout origin/master
, and all my local files are gone.
Is there any way to recover them?
Here's what I have done:
git init
git add .
git commit -m "Initial commit"
git push origin master (failed)
git checkout origin/master
Ad
Answer
Assuming your git commit -m "Initial commit"
step actually completed successfully, then your local master
should have all your work. You may switch to that branch to verify this:
git checkout master
I don't know why you thought to checkout origin/master
. This is the remote tracking branch, and it doesn't really have anything to do with your current problem. You need to resolve the reason why your pushes are being rejected.
Ad
source: stackoverflow.com
Related Questions
- → Authenticate with a cookie using laravel 5.1 and jwt
- → Finding a specific GitLab tag from PHP
- → React: How to publish page on server using React-starter-kit
- → babel-loader, webpack, ES2015 modules: "Element type is invalid"
- → Create a function-attribute of a function, which is, in its turn, a method of an object literal
- → Model Validation in laravel 5.1 not working
- → GIT fatal: loose object
- → Laravel validation required rule not working
- → Axios array map callback
- → Where does this `webpack://` come from for `webpack-dev-middleware`?
- → error when trying to modify project in laravel forge
- → GitHub Pages and Jekyll content duplication and SEO issues
- → Use Laravel repositories with Datatables
Ad