git submodules with modified and untracked content - why and how to remove it?

前端 未结 6 1126
天命终不由人
天命终不由人 2020-12-23 11:14

this is what my git status\' result looks like:

# On branch master
# Changed but not updated:
#   (use \"git add ...\" to update wha         


        
6条回答
  •  臣服心动
    2020-12-23 11:50

    I encountered the same situation:

    gongzelong:shadowsocks-android gongzelong$ git status On branch master Your branch is up to date with 'origin/master'.

    Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git checkout -- ..." to discard changes in working directory) (commit or discard the untracked or modified content in submodules)

        modified:   core/src/main/jni/badvpn (modified content)
        modified:   core/src/main/jni/libancillary (modified content)
        modified:   core/src/main/jni/libevent (modified content)
        modified:   core/src/main/jni/redsocks (modified content)
        modified:   core/src/overture/src/github.com/shadowsocks/overture (modified
    

    content)

    no changes added to commit (use "git add" and/or "git commit -a")

    When I git diff to see what is the changes:

    gongzelong:shadowsocks-android gongzelong$ git diff
    diff --git a/core/src/main/jni/badvpn b/core/src/main/jni/badvpn
    --- a/core/src/main/jni/badvpn
    +++ b/core/src/main/jni/badvpn
    @@ -1 +1 @@
    -Subproject commit 58f8a8883e51e5cb97391c4b6733ce255bf11f95
    +Subproject commit 58f8a8883e51e5cb97391c4b6733ce255bf11f95-dirty
    diff --git a/core/src/main/jni/libancillary b/core/src/main/jni/libancillary
    --- a/core/src/main/jni/libancillary
    +++ b/core/src/main/jni/libancillary
    @@ -1 +1 @@
    -Subproject commit 311e5d14f593f16c785bc6605220517eb1f21f6b
    +Subproject commit 311e5d14f593f16c785bc6605220517eb1f21f6b-dirty
    diff --git a/core/src/main/jni/libevent b/core/src/main/jni/libevent
    --- a/core/src/main/jni/libevent
    +++ b/core/src/main/jni/libevent
    @@ -1 +1 @@
    -Subproject commit f29f07bc8c43eec96f227e6f6eede32b3af66168
    +Subproject commit f29f07bc8c43eec96f227e6f6eede32b3af66168-dirty
    diff --git a/core/src/main/jni/redsocks b/core/src/main/jni/redsocks
    --- a/core/src/main/jni/redsocks
    +++ b/core/src/main/jni/redsocks
    @@ -1 +1 @@
    -Subproject commit 274334f14839431ae003774d99c3d1de337afff4
    +Subproject commit 274334f14839431ae003774d99c3d1de337afff4-dirty
    diff --git a/core/src/overture/src/github.com/shadowsocks/overture b/core/src/overture/src/github.com/shadowsocks/overture
    --- a/core/src/overture/src/github.com/shadowsocks/overture
    +++ b/core/src/overture/src/github.com/shadowsocks/overture
    @@ -1 +1 @@
    -Subproject commit a9b5a94e215c1beadfe11442994b550e1e81f8d6
    +Subproject commit a9b5a94e215c1beadfe11442994b550e1e81f8d6-dirty
    

    I fixed it like this:

    gongzelong:shadowsocks-android gongzelong$ git submodule update --init gongzelong:shadowsocks-android gongzelong$ git submodule foreach git reset --hard Entering 'core/src/main/jni/badvpn'

    HEAD is now at 58f8a88 Fix bug UDP checksum calculation. Entering 'core/src/main/jni/libancillary' HEAD is now at 311e5d1 Fix C++ building Entering 'core/src/main/jni/libev' HEAD is now at 5213419 Merge pull request #2 from Mygod/master Entering 'core/src/main/jni/libevent' HEAD is now at f29f07bc Update to 2.1.8 Entering 'core/src/main/jni/libsodium' HEAD is now at c5e43f4c Update dotnet example version Entering 'core/src/main/jni/mbedtls' HEAD is now at 4f0929189 Update version number to 2.6.1 Entering 'core/src/main/jni/pcre' HEAD is now at 222bbf4 Merge "pcre: silence uninteresting warnings." am: 0e44fd55f8 Entering 'core/src/main/jni/redsocks' HEAD is now at 274334f Use standard ANDROID preprocessor macro (#1) Entering 'core/src/main/jni/shadowsocks-libev' HEAD is now at 57e74ea Fix a bug in bypassing Entering 'core/src/overture/src/github.com/shadowsocks/overture' HEAD is now at a9b5a94 Format the source code gongzelong:shadowsocks-android gongzelong$ gongzelong:shadowsocks-android gongzelong$ git status On branch master Your branch is up to date with 'origin/master'.

    nothing to commit, working tree clean

    Reference: git-discard-submodule-changes

提交回复
热议问题