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












45















this is what my git status' result looks like:



# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (commit or discard the untracked or modified content in submodules)
#
# modified: vim/bundle/pathogen (modified content)
# modified: vim/bundle/sparkup (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")


running git diff vim shows this:



diff --git a/vim/bundle/pathogen b/vim/bundle/pathogen
--- a/vim/bundle/pathogen
+++ b/vim/bundle/pathogen
@@ -1 +1 @@
-Subproject commit fcf77f5101f3e589ce006c40ad3a0432735a05cf
+Subproject commit fcf77f5101f3e589ce006c40ad3a0432735a05cf-dirty
diff --git a/vim/bundle/sparkup b/vim/bundle/sparkup
--- a/vim/bundle/sparkup
+++ b/vim/bundle/sparkup
@@ -1 +1 @@
-Subproject commit 04a81b41f116a19184359a6f8685c192f5c36c70
+Subproject commit 04a81b41f116a19184359a6f8685c192f5c36c70-dirty


Why is the one untracked, the other modified, what does the diff mean? But most important: how did it happen and how to get rid of it?










share|improve this question























  • This answer: stackoverflow.com/a/5127213/199649 evokes more option.

    – charlax
    Jan 14 '12 at 19:34
















45















this is what my git status' result looks like:



# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (commit or discard the untracked or modified content in submodules)
#
# modified: vim/bundle/pathogen (modified content)
# modified: vim/bundle/sparkup (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")


running git diff vim shows this:



diff --git a/vim/bundle/pathogen b/vim/bundle/pathogen
--- a/vim/bundle/pathogen
+++ b/vim/bundle/pathogen
@@ -1 +1 @@
-Subproject commit fcf77f5101f3e589ce006c40ad3a0432735a05cf
+Subproject commit fcf77f5101f3e589ce006c40ad3a0432735a05cf-dirty
diff --git a/vim/bundle/sparkup b/vim/bundle/sparkup
--- a/vim/bundle/sparkup
+++ b/vim/bundle/sparkup
@@ -1 +1 @@
-Subproject commit 04a81b41f116a19184359a6f8685c192f5c36c70
+Subproject commit 04a81b41f116a19184359a6f8685c192f5c36c70-dirty


Why is the one untracked, the other modified, what does the diff mean? But most important: how did it happen and how to get rid of it?










share|improve this question























  • This answer: stackoverflow.com/a/5127213/199649 evokes more option.

    – charlax
    Jan 14 '12 at 19:34














45












45








45


12






this is what my git status' result looks like:



# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (commit or discard the untracked or modified content in submodules)
#
# modified: vim/bundle/pathogen (modified content)
# modified: vim/bundle/sparkup (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")


running git diff vim shows this:



diff --git a/vim/bundle/pathogen b/vim/bundle/pathogen
--- a/vim/bundle/pathogen
+++ b/vim/bundle/pathogen
@@ -1 +1 @@
-Subproject commit fcf77f5101f3e589ce006c40ad3a0432735a05cf
+Subproject commit fcf77f5101f3e589ce006c40ad3a0432735a05cf-dirty
diff --git a/vim/bundle/sparkup b/vim/bundle/sparkup
--- a/vim/bundle/sparkup
+++ b/vim/bundle/sparkup
@@ -1 +1 @@
-Subproject commit 04a81b41f116a19184359a6f8685c192f5c36c70
+Subproject commit 04a81b41f116a19184359a6f8685c192f5c36c70-dirty


Why is the one untracked, the other modified, what does the diff mean? But most important: how did it happen and how to get rid of it?










share|improve this question














this is what my git status' result looks like:



# On branch master
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
# (commit or discard the untracked or modified content in submodules)
#
# modified: vim/bundle/pathogen (modified content)
# modified: vim/bundle/sparkup (untracked content)
#
no changes added to commit (use "git add" and/or "git commit -a")


running git diff vim shows this:



diff --git a/vim/bundle/pathogen b/vim/bundle/pathogen
--- a/vim/bundle/pathogen
+++ b/vim/bundle/pathogen
@@ -1 +1 @@
-Subproject commit fcf77f5101f3e589ce006c40ad3a0432735a05cf
+Subproject commit fcf77f5101f3e589ce006c40ad3a0432735a05cf-dirty
diff --git a/vim/bundle/sparkup b/vim/bundle/sparkup
--- a/vim/bundle/sparkup
+++ b/vim/bundle/sparkup
@@ -1 +1 @@
-Subproject commit 04a81b41f116a19184359a6f8685c192f5c36c70
+Subproject commit 04a81b41f116a19184359a6f8685c192f5c36c70-dirty


Why is the one untracked, the other modified, what does the diff mean? But most important: how did it happen and how to get rid of it?







git






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 3 '11 at 10:34









Nils RiedemannNils Riedemann

3,42053159




3,42053159













  • This answer: stackoverflow.com/a/5127213/199649 evokes more option.

    – charlax
    Jan 14 '12 at 19:34



















  • This answer: stackoverflow.com/a/5127213/199649 evokes more option.

    – charlax
    Jan 14 '12 at 19:34

















This answer: stackoverflow.com/a/5127213/199649 evokes more option.

– charlax
Jan 14 '12 at 19:34





This answer: stackoverflow.com/a/5127213/199649 evokes more option.

– charlax
Jan 14 '12 at 19:34












6 Answers
6






active

oldest

votes


















51














One of the tracked files in vim/bundle/pathogen has been modified somehow. There is also some untracked (and unignored) content in the submodule vim/bundle/sparkup. In either case, the way to figure out what is modified / untracked is to change into the submodule directory and run git status. (In the case of untracked files in a submodule, this is frequently a build product that has not been added to .gitignore in upstream.)






share|improve this answer



















  • 22





    +1 about change into the submodule directory !

    – Philip Oakley
    Nov 5 '11 at 16:02











  • +1 seems obvious, but this stumped me for a bit. My submodule was not ignoring anything, but the root repo was.

    – bentford
    Apr 24 '12 at 23:10



















41














Add ignore = dirty to each problematic submodule section in .gitmodules files placed at root of repo. Example:



[submodule "vim/bundle/nerdtree"]                                               
path = vim/bundle/nerdtree
url = https://github.com/scrooloose/nerdtree.git
ignore = dirty


As seen at NilsH's How to ignore changes in git submodules. Found thanks to Synchronizing plugins with git submodules and pathogen vimcast.






share|improve this answer



















  • 1





    very useful. thanks

    – nouh
    Jul 3 '12 at 6:46



















23














Head into the submodule's directory and make sure there isn't anything being built (an output of some kind) w/o you knowing.



cd submoduledir/
git status


If you see any untracked files in here, just do this to remove them:



git reset --hard HEAD
git clean -fxd





share|improve this answer



















  • 1





    I found that even though the untracked files didn't actually exist on disk, Git seemed to be behaving as if they were. I don't know why this happened, but using the clean command as per your example worked.

    – David Oliver
    Sep 4 '14 at 17:33






  • 2





    Thank you for removing everything that was under .gitignore. Now my entire IDE configuration and vendor cache is gone... N.B. this will remove everything that is .gitignore'd

    – Michael Yoo
    Jul 14 '15 at 13:13













  • i like clean and fast solution :)

    – vivi
    Jan 22 at 15:34



















4














If you're really sure you want to just do it (I'm managing vim bundles with pathogen and git submodules and some how I managed to get some tags folders in repos - and they just had to go) you can loop through submodules and remove untracked files.



cd YOUR_REPO_WITH_SUBMODULES/
git submodule foreach git clean -f -d


-f to force, -d to remove directories



You can check the docs here: https://git-scm.com/docs/git-clean






share|improve this answer































    1














    As the author of pathogen states in the FAQ, you can ignore tags globally:



    git config --global core.excludesfile '~/.cvsignore'
    echo tags >> ~/.cvsignore





    share|improve this answer

































      1














      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






      share|improve this answer























        Your Answer






        StackExchange.ifUsing("editor", function () {
        StackExchange.using("externalEditor", function () {
        StackExchange.using("snippets", function () {
        StackExchange.snippets.init();
        });
        });
        }, "code-snippets");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "1"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        autoActivateHeartbeat: false,
        convertImagesToLinks: true,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: 10,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7993413%2fgit-submodules-with-modified-and-untracked-content-why-and-how-to-remove-it%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        6 Answers
        6






        active

        oldest

        votes








        6 Answers
        6






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        51














        One of the tracked files in vim/bundle/pathogen has been modified somehow. There is also some untracked (and unignored) content in the submodule vim/bundle/sparkup. In either case, the way to figure out what is modified / untracked is to change into the submodule directory and run git status. (In the case of untracked files in a submodule, this is frequently a build product that has not been added to .gitignore in upstream.)






        share|improve this answer



















        • 22





          +1 about change into the submodule directory !

          – Philip Oakley
          Nov 5 '11 at 16:02











        • +1 seems obvious, but this stumped me for a bit. My submodule was not ignoring anything, but the root repo was.

          – bentford
          Apr 24 '12 at 23:10
















        51














        One of the tracked files in vim/bundle/pathogen has been modified somehow. There is also some untracked (and unignored) content in the submodule vim/bundle/sparkup. In either case, the way to figure out what is modified / untracked is to change into the submodule directory and run git status. (In the case of untracked files in a submodule, this is frequently a build product that has not been added to .gitignore in upstream.)






        share|improve this answer



















        • 22





          +1 about change into the submodule directory !

          – Philip Oakley
          Nov 5 '11 at 16:02











        • +1 seems obvious, but this stumped me for a bit. My submodule was not ignoring anything, but the root repo was.

          – bentford
          Apr 24 '12 at 23:10














        51












        51








        51







        One of the tracked files in vim/bundle/pathogen has been modified somehow. There is also some untracked (and unignored) content in the submodule vim/bundle/sparkup. In either case, the way to figure out what is modified / untracked is to change into the submodule directory and run git status. (In the case of untracked files in a submodule, this is frequently a build product that has not been added to .gitignore in upstream.)






        share|improve this answer













        One of the tracked files in vim/bundle/pathogen has been modified somehow. There is also some untracked (and unignored) content in the submodule vim/bundle/sparkup. In either case, the way to figure out what is modified / untracked is to change into the submodule directory and run git status. (In the case of untracked files in a submodule, this is frequently a build product that has not been added to .gitignore in upstream.)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 3 '11 at 10:57









        Mark LongairMark Longair

        296k61357301




        296k61357301








        • 22





          +1 about change into the submodule directory !

          – Philip Oakley
          Nov 5 '11 at 16:02











        • +1 seems obvious, but this stumped me for a bit. My submodule was not ignoring anything, but the root repo was.

          – bentford
          Apr 24 '12 at 23:10














        • 22





          +1 about change into the submodule directory !

          – Philip Oakley
          Nov 5 '11 at 16:02











        • +1 seems obvious, but this stumped me for a bit. My submodule was not ignoring anything, but the root repo was.

          – bentford
          Apr 24 '12 at 23:10








        22




        22





        +1 about change into the submodule directory !

        – Philip Oakley
        Nov 5 '11 at 16:02





        +1 about change into the submodule directory !

        – Philip Oakley
        Nov 5 '11 at 16:02













        +1 seems obvious, but this stumped me for a bit. My submodule was not ignoring anything, but the root repo was.

        – bentford
        Apr 24 '12 at 23:10





        +1 seems obvious, but this stumped me for a bit. My submodule was not ignoring anything, but the root repo was.

        – bentford
        Apr 24 '12 at 23:10













        41














        Add ignore = dirty to each problematic submodule section in .gitmodules files placed at root of repo. Example:



        [submodule "vim/bundle/nerdtree"]                                               
        path = vim/bundle/nerdtree
        url = https://github.com/scrooloose/nerdtree.git
        ignore = dirty


        As seen at NilsH's How to ignore changes in git submodules. Found thanks to Synchronizing plugins with git submodules and pathogen vimcast.






        share|improve this answer



















        • 1





          very useful. thanks

          – nouh
          Jul 3 '12 at 6:46
















        41














        Add ignore = dirty to each problematic submodule section in .gitmodules files placed at root of repo. Example:



        [submodule "vim/bundle/nerdtree"]                                               
        path = vim/bundle/nerdtree
        url = https://github.com/scrooloose/nerdtree.git
        ignore = dirty


        As seen at NilsH's How to ignore changes in git submodules. Found thanks to Synchronizing plugins with git submodules and pathogen vimcast.






        share|improve this answer



















        • 1





          very useful. thanks

          – nouh
          Jul 3 '12 at 6:46














        41












        41








        41







        Add ignore = dirty to each problematic submodule section in .gitmodules files placed at root of repo. Example:



        [submodule "vim/bundle/nerdtree"]                                               
        path = vim/bundle/nerdtree
        url = https://github.com/scrooloose/nerdtree.git
        ignore = dirty


        As seen at NilsH's How to ignore changes in git submodules. Found thanks to Synchronizing plugins with git submodules and pathogen vimcast.






        share|improve this answer













        Add ignore = dirty to each problematic submodule section in .gitmodules files placed at root of repo. Example:



        [submodule "vim/bundle/nerdtree"]                                               
        path = vim/bundle/nerdtree
        url = https://github.com/scrooloose/nerdtree.git
        ignore = dirty


        As seen at NilsH's How to ignore changes in git submodules. Found thanks to Synchronizing plugins with git submodules and pathogen vimcast.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 18 '12 at 17:48









        ciastekciastek

        1,1231015




        1,1231015








        • 1





          very useful. thanks

          – nouh
          Jul 3 '12 at 6:46














        • 1





          very useful. thanks

          – nouh
          Jul 3 '12 at 6:46








        1




        1





        very useful. thanks

        – nouh
        Jul 3 '12 at 6:46





        very useful. thanks

        – nouh
        Jul 3 '12 at 6:46











        23














        Head into the submodule's directory and make sure there isn't anything being built (an output of some kind) w/o you knowing.



        cd submoduledir/
        git status


        If you see any untracked files in here, just do this to remove them:



        git reset --hard HEAD
        git clean -fxd





        share|improve this answer



















        • 1





          I found that even though the untracked files didn't actually exist on disk, Git seemed to be behaving as if they were. I don't know why this happened, but using the clean command as per your example worked.

          – David Oliver
          Sep 4 '14 at 17:33






        • 2





          Thank you for removing everything that was under .gitignore. Now my entire IDE configuration and vendor cache is gone... N.B. this will remove everything that is .gitignore'd

          – Michael Yoo
          Jul 14 '15 at 13:13













        • i like clean and fast solution :)

          – vivi
          Jan 22 at 15:34
















        23














        Head into the submodule's directory and make sure there isn't anything being built (an output of some kind) w/o you knowing.



        cd submoduledir/
        git status


        If you see any untracked files in here, just do this to remove them:



        git reset --hard HEAD
        git clean -fxd





        share|improve this answer



















        • 1





          I found that even though the untracked files didn't actually exist on disk, Git seemed to be behaving as if they were. I don't know why this happened, but using the clean command as per your example worked.

          – David Oliver
          Sep 4 '14 at 17:33






        • 2





          Thank you for removing everything that was under .gitignore. Now my entire IDE configuration and vendor cache is gone... N.B. this will remove everything that is .gitignore'd

          – Michael Yoo
          Jul 14 '15 at 13:13













        • i like clean and fast solution :)

          – vivi
          Jan 22 at 15:34














        23












        23








        23







        Head into the submodule's directory and make sure there isn't anything being built (an output of some kind) w/o you knowing.



        cd submoduledir/
        git status


        If you see any untracked files in here, just do this to remove them:



        git reset --hard HEAD
        git clean -fxd





        share|improve this answer













        Head into the submodule's directory and make sure there isn't anything being built (an output of some kind) w/o you knowing.



        cd submoduledir/
        git status


        If you see any untracked files in here, just do this to remove them:



        git reset --hard HEAD
        git clean -fxd






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Sep 17 '13 at 1:30









        MaurizioMaurizio

        3,91412428




        3,91412428








        • 1





          I found that even though the untracked files didn't actually exist on disk, Git seemed to be behaving as if they were. I don't know why this happened, but using the clean command as per your example worked.

          – David Oliver
          Sep 4 '14 at 17:33






        • 2





          Thank you for removing everything that was under .gitignore. Now my entire IDE configuration and vendor cache is gone... N.B. this will remove everything that is .gitignore'd

          – Michael Yoo
          Jul 14 '15 at 13:13













        • i like clean and fast solution :)

          – vivi
          Jan 22 at 15:34














        • 1





          I found that even though the untracked files didn't actually exist on disk, Git seemed to be behaving as if they were. I don't know why this happened, but using the clean command as per your example worked.

          – David Oliver
          Sep 4 '14 at 17:33






        • 2





          Thank you for removing everything that was under .gitignore. Now my entire IDE configuration and vendor cache is gone... N.B. this will remove everything that is .gitignore'd

          – Michael Yoo
          Jul 14 '15 at 13:13













        • i like clean and fast solution :)

          – vivi
          Jan 22 at 15:34








        1




        1





        I found that even though the untracked files didn't actually exist on disk, Git seemed to be behaving as if they were. I don't know why this happened, but using the clean command as per your example worked.

        – David Oliver
        Sep 4 '14 at 17:33





        I found that even though the untracked files didn't actually exist on disk, Git seemed to be behaving as if they were. I don't know why this happened, but using the clean command as per your example worked.

        – David Oliver
        Sep 4 '14 at 17:33




        2




        2





        Thank you for removing everything that was under .gitignore. Now my entire IDE configuration and vendor cache is gone... N.B. this will remove everything that is .gitignore'd

        – Michael Yoo
        Jul 14 '15 at 13:13







        Thank you for removing everything that was under .gitignore. Now my entire IDE configuration and vendor cache is gone... N.B. this will remove everything that is .gitignore'd

        – Michael Yoo
        Jul 14 '15 at 13:13















        i like clean and fast solution :)

        – vivi
        Jan 22 at 15:34





        i like clean and fast solution :)

        – vivi
        Jan 22 at 15:34











        4














        If you're really sure you want to just do it (I'm managing vim bundles with pathogen and git submodules and some how I managed to get some tags folders in repos - and they just had to go) you can loop through submodules and remove untracked files.



        cd YOUR_REPO_WITH_SUBMODULES/
        git submodule foreach git clean -f -d


        -f to force, -d to remove directories



        You can check the docs here: https://git-scm.com/docs/git-clean






        share|improve this answer




























          4














          If you're really sure you want to just do it (I'm managing vim bundles with pathogen and git submodules and some how I managed to get some tags folders in repos - and they just had to go) you can loop through submodules and remove untracked files.



          cd YOUR_REPO_WITH_SUBMODULES/
          git submodule foreach git clean -f -d


          -f to force, -d to remove directories



          You can check the docs here: https://git-scm.com/docs/git-clean






          share|improve this answer


























            4












            4








            4







            If you're really sure you want to just do it (I'm managing vim bundles with pathogen and git submodules and some how I managed to get some tags folders in repos - and they just had to go) you can loop through submodules and remove untracked files.



            cd YOUR_REPO_WITH_SUBMODULES/
            git submodule foreach git clean -f -d


            -f to force, -d to remove directories



            You can check the docs here: https://git-scm.com/docs/git-clean






            share|improve this answer













            If you're really sure you want to just do it (I'm managing vim bundles with pathogen and git submodules and some how I managed to get some tags folders in repos - and they just had to go) you can loop through submodules and remove untracked files.



            cd YOUR_REPO_WITH_SUBMODULES/
            git submodule foreach git clean -f -d


            -f to force, -d to remove directories



            You can check the docs here: https://git-scm.com/docs/git-clean







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 10 '16 at 15:00









            bloke_zerobloke_zero

            342312




            342312























                1














                As the author of pathogen states in the FAQ, you can ignore tags globally:



                git config --global core.excludesfile '~/.cvsignore'
                echo tags >> ~/.cvsignore





                share|improve this answer






























                  1














                  As the author of pathogen states in the FAQ, you can ignore tags globally:



                  git config --global core.excludesfile '~/.cvsignore'
                  echo tags >> ~/.cvsignore





                  share|improve this answer




























                    1












                    1








                    1







                    As the author of pathogen states in the FAQ, you can ignore tags globally:



                    git config --global core.excludesfile '~/.cvsignore'
                    echo tags >> ~/.cvsignore





                    share|improve this answer















                    As the author of pathogen states in the FAQ, you can ignore tags globally:



                    git config --global core.excludesfile '~/.cvsignore'
                    echo tags >> ~/.cvsignore






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Oct 27 '12 at 17:05









                    Garrett Hyde

                    4,30673945




                    4,30673945










                    answered Apr 5 '12 at 12:32









                    flycarlflycarl

                    112




                    112























                        1














                        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






                        share|improve this answer




























                          1














                          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






                          share|improve this answer


























                            1












                            1








                            1







                            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






                            share|improve this answer













                            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







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Nov 16 '18 at 7:09









                            Francis BaconFrancis Bacon

                            5991518




                            5991518






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Stack Overflow!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7993413%2fgit-submodules-with-modified-and-untracked-content-why-and-how-to-remove-it%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                Bressuire

                                Vorschmack

                                Quarantine