git how to recover the last commit files

Tiina

After I commit some files, the local files are changed. And now I want to recover the local directory to exactly the same as last time commit. In the following figure, local uncommitted changes corrupted, so I want to take out the master basic operators.... I have already tried git reset [the first commit hash code from git log], but nothing changes.

enter image description here

jbu

git reset <commit> changes where your HEAD points to but doesn't restore your files to how they were at that commit. If you want to restore the files to how it looks at the commit, you need git reset --hard <commit>

About the three reset modes:

       --soft
           Does not touch the index file or the working tree at all (but
           resets the head to <commit>, just like all modes do). This
           leaves all your changed files "Changes to be committed", as git
           status would put it.

       --mixed
           Resets the index but not the working tree (i.e., the changed
           files are preserved but not marked for commit) and reports what
           has not been updated. This is the default action.

           If -N is specified, removed paths are marked as intent-to-add
           (see git-add(1)).

       --hard
           Resets the index and working tree. Any changes to tracked files
           in the working tree since <commit> are discarded.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to add a file to the last commit in git?

From Java

How to undo the last commit in git

From Dev

Files deleted after rebase with git, how to recover?

From Dev

How to recover last commit after git hard reset?

From Dev

How to see files in a particular commit in git?

From Dev

how to do a git diff of current commit with last commit using gitpython?

From Dev

How to commit in git many files

From Dev

How to recover files added to git but overwritten by checkout

From Dev

Does git commit --amend include the files that were in the last commit?

From Dev

How to remove not-last commit in Git?

From Dev

How to commit & push selected files but not all in Git

From Dev

Git - replace working tree files with those from a certain (last) commit

From Dev

How to add multiple files in git for a single commit?

From Dev

How to get second last commit hash in git

From Dev

How to prevent git commit from deleting files

From Dev

How to add untracked file in last git commit?

From Dev

Recover files from previous git commit after git rm

From Dev

Distribute changes to files to the last commit to modify each file (fixup last commit that changed the file) with Git

From Dev

How do I recover files using git?

From Dev

How to commit my files in a git bare repo

From Dev

How to recover last commit after git hard reset?

From Dev

How to recover files added to git but overwritten by checkout

From Dev

How to remove not-last commit in Git?

From Dev

How to include files in my Git commit with PHPStorm?

From Dev

Git Repository How to recover deleted files?

From Dev

Git - replace working tree files with those from a certain (last) commit

From Dev

How to copy the last commit as a new commit in Git?

From Dev

Remove files from last git commit

From Dev

How to recover a commit in git

Related Related

  1. 1

    How to add a file to the last commit in git?

  2. 2

    How to undo the last commit in git

  3. 3

    Files deleted after rebase with git, how to recover?

  4. 4

    How to recover last commit after git hard reset?

  5. 5

    How to see files in a particular commit in git?

  6. 6

    how to do a git diff of current commit with last commit using gitpython?

  7. 7

    How to commit in git many files

  8. 8

    How to recover files added to git but overwritten by checkout

  9. 9

    Does git commit --amend include the files that were in the last commit?

  10. 10

    How to remove not-last commit in Git?

  11. 11

    How to commit & push selected files but not all in Git

  12. 12

    Git - replace working tree files with those from a certain (last) commit

  13. 13

    How to add multiple files in git for a single commit?

  14. 14

    How to get second last commit hash in git

  15. 15

    How to prevent git commit from deleting files

  16. 16

    How to add untracked file in last git commit?

  17. 17

    Recover files from previous git commit after git rm

  18. 18

    Distribute changes to files to the last commit to modify each file (fixup last commit that changed the file) with Git

  19. 19

    How do I recover files using git?

  20. 20

    How to commit my files in a git bare repo

  21. 21

    How to recover last commit after git hard reset?

  22. 22

    How to recover files added to git but overwritten by checkout

  23. 23

    How to remove not-last commit in Git?

  24. 24

    How to include files in my Git commit with PHPStorm?

  25. 25

    Git Repository How to recover deleted files?

  26. 26

    Git - replace working tree files with those from a certain (last) commit

  27. 27

    How to copy the last commit as a new commit in Git?

  28. 28

    Remove files from last git commit

  29. 29

    How to recover a commit in git

HotTag

Archive