I changed my MAC before, and our system was a mountain of shit, so when I installed the dependency, I reported a lot of errors inexplicably. If I wanted to use the dependency, I had to upgrade the dependency reporting errors, and then a proxy file related to the dependency also needed to be changed. Other parts that move more, they don’t change, they can run.

So my local code is different from other colleagues’ code with package.json and proxy files. In order not to have trouble uploading them every time (I don’t upload those two files, SO I put ignore in it), I also thought, if my ignore file is also ignored, then, None of these files will be uploaded, just the other files that have been changed.

So I, cleverly, added the following paragraph to.gitignore

# for hr mac
package.json
src/setupProxy.js
.gitignore
Copy the code

As a result, when I went to work the next day, my colleagues all went crazy. They all reported an error and couldn’t get up. Some of them didn’t submit the code yesterday and reported an error here, and then went crazy.

git reset --hard 68712c6de859f5e891b02e76cf6c82d44d484948
Copy the code

To solve this problem, execute the command above and restore to the previous version.

Ignore, originally thought to ignore the local file, the repository is still there. In fact, after ignore, the repository is deleted.

Git add. Git commit -m "XXX" git push git checkout branch git stash pop git git rm -r --cached. // Clear the local cacheCopy the code

Gitignore rules

#maven
target/

#IDEA
.idea/
*.iml

#eclipse
.settings/
.metadata/
.classpath
.projectServices/
Copy the code

#: Comment a line

Aa /: Ignores all files in the AA directory

Bb: ignore the bb file

*. A: Files ending in. A are ignored

! TXT: except the cc. TXT file

If the project has already been uploaded and there is a local cache, the above configuration will be invalid and the file will still be uploaded.

Therefore, you need to clear the local cache before uploading. And then push.