Git error collection

Here is a summary of some errors and solutions encountered in the process of using git

Changes not staged for commit:

Problem Description

The cause of the matter was that I was tinkering with the version control of Qt. First, I created a .git file in a project, and created a corresponding repository on GitHub, generated some basic README.m, .gitignore, etc., and pulled it locally Project.

Then I think it is a bit wasteful to put a project in a GitHub warehouse, and I want to put multiple Qt hands-on projects written before in this GitHub warehouse, just like the visual studio solution, to manage multiple projects.

Insert picture description here
So I created a .git file in qt_workspace, and copied the README.m, .gitignore, etc. in the previous project directly to save trouble.

As a result, when pushing qt_workspace, the project of opencv_startDemo can only push the last empty folder. After git status:
(similar to the following situation)
Insert picture description here
enter opencv_startDemo to add manually, an error is reported:

fatal: Pathspec ‘xxx’ is in submodule

solution

git rm -rf --cached opencv_startDemo/
git add .

Insert picture description here
problem solved.

Guess you like

Origin blog.csdn.net/weixin_44456692/article/details/110491154