git filter demand a detailed submission

Problem Scenario

Management code when using git, git white as I always encounter some problem can not understand, consult some experts after finally solved the doubt, refer to the following scenario: 1. For example, we have completed on the computer by vs 1 edit an item, add the author to complete the process server, as Figure 1 
 
 

FIG 1 normal code delivery process


2.git status command to view the uncommitted items, no submissions will be displayed; 

  

3. opened again by vs editor program, no operation can; 4. uncommitted git status command to check the item again, as in FIG. 
 
 

From the map you can see, even if you do not do anything, there will be a lot of files that were not submitted were prompted out, because sometimes if we neglect that document does not change (in fact, at that moment the background file to open the project has changed ), then turn off the computer (PC 2) present on the edit other computer engineering, and then the flow of FIG. 1 will be submitted to the code. Then when git pull, there is the problem not add local files will appear on a computer.

Solve the problem

To resolve this problem, we need to add some of the file type or the name of the editor background operation needs to be shielded in .gitignore file, so after accidentally opening the project through the code without side effects. If we upload the first version of the code is not shielded as .suo, .ide such documents, even if later add these file types to .gitignore, always use the git status command will always appear uncommitted changes on these files, As shown below. 
 
 

To resolve this problem, first of all to .suo or .ide .gitignore file type is added to the file, and then use these two types of files on the git rm -r --cached filename delete server. 
 

When so used git status command to view the uncommitted file again, it will only show you the edited file, the compiler will no longer behind the scenes suggests.

Shield .ide documents [Why does it not match ide delete files to it? ]

First, consider the following example: 
 

This is the path problem: 

ide文件都在RealEstate目录下了,路径要改成最后框选的那个。 
删除命令如下: 
git rm -r --cached /i/mypros/RealEstate/.vs/RealEstate/v16/Server/sqlite3/storage.ide
 

这样就可以删除成功了。

 

以上为个人的一些心得,如有总结的错误请谅解并指出错误或更好的解决办法。

想要了解更多,请关注个人微信公众号  夜无澜。

 

Guess you like

Origin www.cnblogs.com/Zqyxr/p/12176451.html