github changes not staged for commit

后端 未结 13 619
[愿得一人]
[愿得一人] 2020-12-23 13:31

I have a very basic github setup with a readme, a directory, and another directory inside it with an html file. On github I can only view the readme and the first folder but

相关标签:
13条回答
  • 2020-12-23 13:55

    For me, I had to commit the subdirectories which had .git in it since both the parent and the subfolder have remotes to push to. And then commit and push the parent directory.

    0 讨论(0)
  • 2020-12-23 13:58

    in my case, I needed a

     git add files
     git commit -am 'what I changed'
     git push
    

    the 'a' on the commit was needed.

    0 讨论(0)
  • 2020-12-23 14:00

    Is week1 a submodule?

    Note the relevant part from the output of the git status command:

    (commit or discard the untracked or modified content in submodules)

    Try cd week1 and issuing another git status to see what changes you have made to the week1 submodule.

    See http://git-scm.com/book/en/Git-Tools-Submodules for more information about how submodules work in Git.

    0 讨论(0)
  • 2020-12-23 14:02

    Believe this occurs because you have a child repository "submodule" that has changes which have not been staged and committed.

    Had a similar problem, where my IDE kept reporting uncommitted changes, and running the stage (git add .) and commit (git commit -m "message") commands had no effect. Thinking about this in hindsight, it's probably because the child repository had the changes that needed to be staged and committed, not the parent repository.

    Steps that fixed the issue

    1. cd into the submodule (has a hidden folder named .git) and execute the commands to stage (git add .) and commit (git commit -m "Update child repo")
    2. cd .. back to the parent repo, and execute the commands to stage (git add .) and commit (git commit -m "Update parent repo")

    Advice that wasn't helpful

    • sudo rm -Rf .git == DO NOT USE THIS COMMAND == it permanently deletes submodule repository history (the purpose of GIT)
    • git add -A === Added untracked files, but didn't fix issue
    0 讨论(0)
  • 2020-12-23 14:06

    WARNING! THIS WILL DELETE THE ENTIRE GIT HISTORY FOR YOUR SUBMODULE. ONLY DO THIS IF YOU CREATED THE SUBMODULE BY ACCIDENT. CERTAINLY NOT WHAT YOU WANT TO DO IN MOST CASES.

    I think you have to go inside week1 folder and delete the .git folder:

    sudo rm -Rf .git
    

    then go back to top level folder and do:

    git add .
    

    then do a commit and push the code.

    0 讨论(0)
  • 2020-12-23 14:09

    I was having the same problem. I ended up going into the subdirectory that was "not staged for commit" and adding, committing and pushing from there. after that, went up one level to master directory and was able to push correctly.

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