Undoing changes

This question already has an answer here:

  • How do I clear my local working directory in git? [duplicate] 6 answers
  • How to remove local (untracked) files from the current Git working tree? 31 answers

  • to set my working directory just how it was until my last commit, so basicly all new -untracked files and folders and all changes to existing files will no longer exist.

    To reset your changes which were not commited, just hit

    git reset --hard HEAD 
    

    to revert to your last commit.

    I'm not sure if I got your second part of the question right, but I will try to explain it:

    If you want to keep your changes and want to apply them on another branch, combine it with Git stash.

    git stash save
    git reset --hard HEAD
    // do what you want to do and switch branches
    git stash pop
    
    链接地址: http://www.djcxy.com/p/3272.html

    上一篇: 有没有简单的方法来删除未跟踪的git文件

    下一篇: 撤消更改