I tried this answer How do I undo the most recent local commits in Git? and run git reset HEAD~ but I had the following errorįatal: ambiguous argument 'HEAD~': unknown revision or path not in the working tree. The git reset command also includes options to update the other parts of your local environment with the contents of the commit where you end up.These options include: hard to reset the commit being pointed to in the repository, populate the working directory with the contents of the commit, and reset the staging area soft to only reset the pointer in the repository and mixed (the default.I used to use TFS in the past and any mistake could be easily rollbacked in 1 minute, here I've spent hours trying to look for the right command in the Git book but can't find how to restore the previous version? Is it at least possible to rollback in Git? Unsuccessful attempts to solve this issue When I run git ls-tree only one file is return: $ git ls-tree -r master -name-onlyĪs you can see we've lost everything. When I wanted to check on the server if the commit worked, all the files of the project have vanished! There is just one file: entities.py. + 4a0d8a5.1dc09d9 master -> master (forced update) Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 Git detected the change in entities.py so I thought I was good to go: $ git commit -m "entities.py first commit" Then as I only modified entities.py I added it to the list for commit: $ git add entities.py Nothing added to commit but untracked files present (use "git add" to track) Here is what I've done (note this is the first I'm connecting to this Git server). I wanted to see if I could commit a change in a file but after doing so all the files of the repo have disappeared.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |