• git patch的使用 &git怎样删除未监视的文件untracked files &git 撤销commit


    [git patch的使用]

    http://blog.csdn.net/kangear/article/details/39675421

    Git打补丁常见问题

      往往觉得得到某个功能的补丁就认为这个功能我就已经成功拥有 了,但是在最后一步的打补丁的工作也是需要相当谨慎的,甚至有可能还要比你获取这个补丁花费的时间还要多。看到好多同行遇到这个问题,且最近自己也花费近 20天「获取,打,验证」一个特性功能的补丁。趁热总结一下,知识点可能不多,但是问题是相当棘手的。


    1. 没有得到产品
    shuliwu@koridy-251:~/D92/pizza$ git am  ../patch/0001-support-screen-record.patch
    Applying: support screen record
    /home/shuliwu/D92/pizza/.git/rebase-apply/patch:60: trailing whitespace.
    bool mIsRecordingScreenANS;
    /home/shuliwu/D92/pizza/.git/rebase-apply/patch:91: trailing whitespace.
     
    /home/shuliwu/D92/pizza/.git/rebase-apply/patch:148: trailing whitespace.
    #if 1 //{      
    /home/shuliwu/D92/pizza/.git/rebase-apply/patch:153: trailing whitespace.
    #endif //}        
    /home/shuliwu/D92/pizza/.git/rebase-apply/patch:237: trailing whitespace.
                   ALOGE("mStarted == true");              
    error: patch failed: device/rockchip/rk30sdk/init.rc:503
    error: device/rockchip/rk30sdk/init.rc: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/SurfaceMediaSource.cpp:53
    error: frameworks/av/media/libstagefright/SurfaceMediaSource.cpp: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/ANetworkSession.cpp:41
    error: frameworks/av/media/libstagefright/wifi-display/ANetworkSession.cpp: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/ANetworkSession.h:75
    error: frameworks/av/media/libstagefright/wifi-display/ANetworkSession.h: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/Converter.cpp:41
    error: frameworks/av/media/libstagefright/wifi-display/source/Converter.cpp: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/Converter.h:37
    error: frameworks/av/media/libstagefright/wifi-display/source/Converter.h: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/MediaPuller.cpp:174
    error: frameworks/av/media/libstagefright/wifi-display/source/MediaPuller.cpp: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/PlaybackSession.cpp:62
    error: frameworks/av/media/libstagefright/wifi-display/source/PlaybackSession.cpp: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/PlaybackSession.h:40
    error: frameworks/av/media/libstagefright/wifi-display/source/PlaybackSession.h: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/RepeaterSource.cpp:24
    error: frameworks/av/media/libstagefright/wifi-display/source/RepeaterSource.cpp: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/Sender.cpp:17
    error: frameworks/av/media/libstagefright/wifi-display/source/Sender.cpp: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/Sender.h:18
    error: frameworks/av/media/libstagefright/wifi-display/source/Sender.h: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp:43
    error: frameworks/av/media/libstagefright/wifi-display/source/WifiDisplaySource.cpp: patch does not apply
    error: patch failed: frameworks/av/media/libstagefright/wifi-display/source/WifiDisplaySource.h:42
    error: frameworks/av/media/libstagefright/wifi-display/source/WifiDisplaySource.h: patch does not apply
    error: patch failed: frameworks/base/api/current.txt:10093
    error: frameworks/base/api/current.txt: patch does not apply
    error: patch failed: frameworks/base/core/java/android/hardware/display/DisplayManager.java:201
    error: frameworks/base/core/java/android/hardware/display/DisplayManager.java: patch does not apply
    error: patch failed: frameworks/base/core/java/android/hardware/display/IDisplayManager.aidl:30
    error: frameworks/base/core/java/android/hardware/display/IDisplayManager.aidl: patch does not apply
    error: patch failed: frameworks/base/core/jni/android_media_RemoteDisplay.cpp:32
    error: frameworks/base/core/jni/android_media_RemoteDisplay.cpp: patch does not apply
    error: patch failed: frameworks/base/media/java/android/media/RemoteDisplay.java:20
    error: frameworks/base/media/java/android/media/RemoteDisplay.java: patch does not apply
    error: patch failed: frameworks/base/services/java/com/android/server/display/WifiDisplayAdapter.java:164
    error: frameworks/base/services/java/com/android/server/display/WifiDisplayAdapter.java: patch does not apply
    error: patch failed: frameworks/base/services/java/com/android/server/display/WifiDisplayController.java:104
    error: frameworks/base/services/java/com/android/server/display/WifiDisplayController.java: patch does not apply
    Patch failed at 0001 support screen record
    When you have resolved this problem run "git am --resolved".
    If you would prefer to skip this patch, instead run "git am --skip".
    To restore the original branch and stop patching run "git am --abort".


    【 git怎样删除未监视的文件untracked files】
    # 删除 untracked files
    git clean -f
     
    # 连 untracked 的目录也一起删掉
    git clean -fd
     
    # 连 gitignore 的untrack 文件/目录也一起删掉 (慎用,一般这个是用来删掉编译出来的 .o之类的文件用的)
    git clean -xfd
     
    # 在用上述 git clean 前,墙裂建议加上 -n 参数来先看看会删掉哪些文件,防止重要文件被误删
    git clean -nxfd
    git clean -nf
    git clean -nfd
    git 撤销commit
        博客分类: git
    gitcommit撤销
    如果不小心commit了一个不需要commit的文件,可以对其进行撤销。
    先使用git log 查看 commit日志
    Python代码  收藏代码

        commit 422bc088a7d6c5429f1d0760d008d86c505f4abe  
        Author: zhyq0826 <zhyq0826@gmail.com>  
        Date:   Tue Sep 4 18:19:23 2012 +0800  
          
            删除最近搜索数目限制  
          
        commit 8da0fd772c3acabd6e21e85287bdcfcfe8e74c85  
        Merge: 461ac36 0283074  
        Author: zhyq0826 <zhyq0826@gmail.com>  
        Date:   Tue Sep 4 18:16:09 2012 +0800 
    找到需要回退的那次commit的 哈希值,

    git reset --hard commit_id

  • 相关阅读:
    《剑指offer》Q01-12 (牛客10.11)
    北京,我来了
    pods的好处
    iOS那些你从未使用过的属性方法
    重构一个运行超过10年的老项目
    C#泛型
    认真思考创建对象的几种方式
    2014年终总结
    前端优化:AMDclean去除requirejs
    webstorm常用快捷键及插件
  • 原文地址:https://www.cnblogs.com/pengxinglove/p/5758145.html
Copyright © 2020-2023  润新知