简体   繁体   中英

How to track sub-directories that change accurately with git

I am having a bit of difficulty picking up git. While tracking and committing text files is easy, every time I add a Visual Studio project folder to a repository, git throws this (modified content) status at me and I can not get it to add the new content to the repository. I can add the files just great the first time, but any time I edit one of these files, I am unable to add the new files to the next commit.

What can I do to add new files, and why is this not working? I attempted to add some gitignore files to see if possibly I should be ignoring some of the extra Visual Studio files, although I'm not sure I have them added correctly and I was having this issue before and after.

While I have found numerous different people asking about this, none of the answers have fixed my issue.

Thanks in advance, I've been pulling my hair out over this, it just seems so simple.

Visual of the problem:

视觉问题

Just adding the file to .gitignore will not stop the file from being tracked by Git because the file VetrinaryOffice is already in the index.

Follow this link to remove the particular file from the index and commit it. The exact set of commands that you will need is typed below:

git rm --cached VetrinaryOffice git add . git commit -m "Removed Vetrinary Office from index"

The File will not be tracked any more. ie, You will no longer receive status alerts about modifications to this file within this Git repository.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM