怎样用 Git 清除不想保存的更改和文件?
天蓬老师
天蓬老师 2017-04-24 09:11:08
0
3
736

几种情况:

  1. 增加了几个文件, 没有add, 不想保存文件, 怎么快速清除文件?

  2. 增加了add了文件, 不想保存文件, 怎样清理?

  3. 修改了文件, 没有add, 怎样清理?

  4. 修改了文件, 已经add, 怎样清理?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

membalas semua (3)
Peter_Zhu
  1. git clean -f(-dif you have new directory )
  2. git reset --hard( orgit resetthen back to 1. )
  3. git checkout .( or specify with file names )
  4. git reset --hard( orgit resetthen back to 3. )
    巴扎黑
    1. git clean -f
    2. git checkout -f
    3. git checkout -forgit checkout .
    4. git checkout -f

    git checkout -f

    -- -- start file arguments -b -- create a new branch based at given commit -B -- create or update branch based at given commit --conflict -- same as --merge, using given merge style --force -f -- force branch switch/ignore unmerged entries --merge -m -- 3way merge current branch, working tree and new branch --no-track -- override the branch.autosetupmerge configuration variable --orphan -- create a new orphan branch based at given commit --ours -- check out stage #2 for unmerged paths --patch -p -- interactively select hunks in diff between given tree-ish a --quiet -q -- suppress feedback messages --theirs -- check out stage #3 for unmerged paths --track -t -- set up configuration so pull merges from the base commit
      黄舟
      1. git status -s | awk '$1 = "?" { print $2 }' | xargs rm -v
      2. git reset --hard
      3. git reset --hard
      4. git reset --hard
        Muat turun terkini
        Lagi>
        kesan web
        Kod sumber laman web
        Bahan laman web
        Templat hujung hadapan
        Tentang kita Penafian Sitemap
        Laman web PHP Cina:Latihan PHP dalam talian kebajikan awam,Bantu pelajar PHP berkembang dengan cepat!