github changes not staged for commit

后端 未结 13 618
[愿得一人]
[愿得一人] 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:46

    I kept receiving the same message no matter what i did.

    To fix this, i removed .gitignore and i am not getting the Github changes not staged for commit message anymore. Before it would allow me to commit once when i ran git add . and then after it would bring up the same message.

    Im not sure why the .gitignore file was causing a problem but i added on my local machine and most likely didn't sync it up properly.

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

    If it's a submodule you need to cd into it then use git add . && git commit -m 'Your message'

    From there you can cd out and push to whichever branch you want.

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

    Have you tried

    git add .
    

    This recurses into sub-directories, whereas I don't think * does.

    See here

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

    In my case the problem was the subfolder that I was tying to push was a git folder itself

    So I did the following

    1. Go inside the subfolder that you want to push and run this:
    rm -rf .git
    
    1. Then run this:
     git rm --cached <subfolderName>
    
    1. Then come to main project folder and run this (make sure to add / after folder name)
        git add <folderName>/
        git commit -m "Commit message"
        git push -f origin <branchName>
    
    
    0 讨论(0)
  • 2020-12-23 13:49

    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.

    In my situation, there was a sub-directory which had a .git directory.

    What I do is simply remove that .git directory from my sub-directory.

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

    This command may solve the problem :

    git add -A

    All the files and subdirectories will be added to be tracked.

    Hope it helps

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