How to fix “modified content, untracked content” in git?

前端 未结 6 868
逝去的感伤
逝去的感伤 2020-12-24 11:29

The objective is to commit a git branch. The output of \"git status\" for the branch is:

On branch zeromq_new
Your branch is up to date with         


        
相关标签:
6条回答
  • 2020-12-24 12:14

    Remove .git from subfolders. This works for me.

    0 讨论(0)
  • 2020-12-24 12:19

    For some reason these separate repos have altered files. There are a couple ways to deal with it, depending what they actually are.

    You can navigate into each repo and see what files are changed. Then you can commit, make a new branch, or get rid of the changes.

    If these repos are seperate projects that you want to track but not mess with, you can make your parent repo simply ignore changes in these submodules with:

    git update-index --assume-unchanged $DIRECTORY

    (where $DIRECTORY is the submodule you want to ignore changes to)

    0 讨论(0)
  • 2020-12-24 12:21

    What happening here is that you are in your root Folder Folder and You want to push all your children to git repository.So a git file is created.And if you get a untraceable or untracked file error the reason is some on your childen directories also have a git repository with it.You can delete the git repository from the untracked or untraceable folder by command ---->rmdir -Force -Recurse .git This command will delete the local git repo in your untracebale or untracked directory and once again go to your root folder and type the same command. Reinitialize the git repo and its Done!!!

    0 讨论(0)
  • 2020-12-24 12:25

    What I did was to run:

    git rm -rf --cached myuntrackedfolder
    

    This tells git to forget about it (since it was being tracked formally).

    Then I used:

    git add myuntrackedfolder 
    

    to add it and I was good to go.

    0 讨论(0)
  • 2020-12-24 12:25

    Solution involves removing .git/ from the directories with the "modified content, untracked content" label, removing the --cached filed from those directories, and then running git add on those directories once again.

    Step-by-step solution:

    1. Remove .git/ from log4cplus and ../lib/notification/cppzmq.
    2. From parent directory from where you initialized your git repository, run the command: git rm -rf --cached log4cplus/ && git rm -rf --cached ../lib/notifications/cppzmq
    3. Add and commit the directories to your branch again.
    4. Push to your branch.

    Happy coding.

    0 讨论(0)
  • 2020-12-24 12:26

    I have closed the editor (Visual Studio) and I typed the usual commands:

    1. git add .
    2. git commit -m "Comment text"
    3. git push -u origin master

    This worked for me.

    0 讨论(0)
提交回复
热议问题