How can I discard modified files?

后端 未结 10 740
甜味超标
甜味超标 2020-12-13 18:00

This is a Linux 2.6 kernel repository. I git clone it to my local host.

After that. I didn\'t make any change. But when I \"git status\". I found 13 modified files.

相关标签:
10条回答
  • 2020-12-13 18:09

    By entering these commands in succession.

    git stash
    git stash drop
    

    git stash stores modified files on a stack for later retrieval.

    git stash drop discards them.

    0 讨论(0)
  • 2020-12-13 18:09

    To restore:

    modified: specific_filename

    git checkout <specific_filename>

    It's safer than removing all files at once using git checkout ..

    0 讨论(0)
  • 2020-12-13 18:11

    You can remove untracked files with clean as well

    git clean -f
    
    0 讨论(0)
  • 2020-12-13 18:12

    You can use:

    git checkout .
    

    To understand the difference between git checkout and git reset refer to the following question :

    What's the difference between "git reset" and "git checkout"?

    0 讨论(0)
  • 2020-12-13 18:15

    The question is similar to Strange behaviour of Git: mysterious changes cannot be undone

    You need a case-insensitive filesystem. If your PC is Apple MAC like me, you can create Case-sensitive disk.

    hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 25g ~/android.dmg
    
    hdiutil resize -size <new-size-you-want>g ~/android.dmg.sparseimage
    
    # mount the android file image
    function mountAndroid { hdiutil attach ~/android.dmg.sparseimage -mountpoint /Volumes/android; }
    
    # unmount the android file image
    function umountAndroid() { hdiutil detach /Volumes/android; }
    
    0 讨论(0)
  • 2020-12-13 18:29

    It happens because the linux kernel includes files with the same name (but different cases):

    include/linux/netfilter/xt_connmark.h 
    include/linux/netfilter/xt_CONNMARK.h
    
    0 讨论(0)
提交回复
热议问题