search

Home  >  Q&A  >  body text

How does git clear the modifications of all files in the workspace that have not been added?

As the title says, more than ten files in the workspace have been modified, but no add has been added yet. How to clear all the modifications at once

Using git checkout -- file can only restore one file at a time, please find a way to restore all files at once

大家讲道理大家讲道理2768 days ago858

reply all(5)I'll reply

  • 習慣沉默

    習慣沉默2017-05-02 09:37:54

    git checkout head .

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-02 09:37:54

    git checkout -f

    reply
    0
  • 滿天的星座

    滿天的星座2017-05-02 09:37:54

    git checkout .
    

    Clear all modifications without add in the current directory.

    reply
    0
  • 某草草

    某草草2017-05-02 09:37:54

    Restore the specified file in the staging area to the workspace
    $ git checkout [file]

    Restore the specified files of a commit to the staging area and workspace
    $ git checkout [commit] [file]
    Restore all files in the staging area to the workspace
    $ git checkout .
    Reset the specified files in the staging area , consistent with the last commit, but the workspace remains unchanged
    $ git reset [file]
    Reset the staging area and workspace, consistent with the last commit
    $ git reset --hard
    Reset the pointer of the current branch For the specified commit, reset the staging area at the same time, but the work area remains unchanged
    $ git reset [commit]
    Reset the HEAD of the current branch to the specified commit, and reset the staging area and work area at the same time, consistent with the specified commit
    $ git reset --hard [commit]
    Reset the current HEAD to the specified commit, but keep the staging area and workspace unchanged
    $ git reset --keep [commit]
    Create a new commit to undo the specified commit
    The latter All changes will be offset by the former and applied to the current branch
    $ git revert [commit]
    Temporarily remove uncommitted changes and move them in later
    $ git stash
    $ git stash pop

    reply
    0
  • 怪我咯

    怪我咯2017-05-02 09:37:54

    git checkout --directory name, delete changes in a certain directory

    reply
    0
  • Cancelreply