検索

ホームページ  >  に質問  >  本文

怎样用 Git 清除不想保存的更改和文件?

几种情况:

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

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

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

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

天蓬老师天蓬老师2845日前822

全員に返信(3)返信します

  • 天蓬老师

    天蓬老师2017-04-24 09:13:08

    1. git clean -f (新しいディレクトリがある場合は -d)git clean -f ( -d if you have new directory )
    2. git reset --hard ( or git reset then back to 1. )
    3. git checkout . ( or specify with file names )
    4. git reset --hard ( or git reset
    5. git restart --hard (または git restart で 1 に戻ります。)
    🎜 git checkout . (またはファイル名で指定)🎜 🎜 git restart --hard (または git restart を実行してから 3 に戻ります。)🎜 🎜

    返事
    0
  • 巴扎黑

    巴扎黑2017-04-24 09:13:08

    1. git clean -f
    2. git clean -f
    3. git checkout -f
    4. git checkout -f or git checkout .
    5. git checkout -f

    git checkout -fgit checkout -f

  • git checkout -f または git checkout . git checkout -f <ブロック引用>

    git checkout -f 🎜 🎜 リーリー

    返事
    0
  • 黄舟

    黄舟2017-04-24 09:13:08

    1. git status -s | awk '$1 = "?" { print $2 }' | xargs rm -vgit status -s | awk ' = "?" { print }' | xargs rm -v
    2. git reset --hard
    3. git reset --hard
    4. git reset --hard
    5. git restart --hard
    🎜git restart --hard🎜 🎜git restart --hard🎜 🎜

    返事
    0
  • キャンセル返事