When adding items to my TDS project under Git resource control, VS adds a little lock to show me it's under source control. However I have some items which are displaying a green plus sign (pending) or a red minus sign (ignored). I've tried deleting the item from VS and then using Get Sitecore Items to get a fresh copy, but it doesn't stick. The items aren't getting pushed up to Git because it doesn't notice the change. How can I add these items?
1 Answer
Sounds very much like you have items that are being ignored by your .gitignore
file.
To find out what is being ignore, open a git command prompt (Git Bash/PowerShell/Command Prompt - whatever your choice of command line tool is) and run this:
git check-ignore -v filename
Where filename
is the name and path of your TDS .item
file. It will return you the line in the .gitignore
file of the rule that is ignoring your file.
Example:
My .gitignore
is setup to ignore my .vs
folder. To check that I can run:
git check-ignore -v .vs
it would return
.gitignore:21:/.vs .vs
The first part is the file adding the ignore rule, in this case .gitignore
, the second part is the line number - 21
and the third part is the rule - /.vs
Once you have that you can either remove the rule or force the add. To force the add on the command line do:
git add --force path/filename
Then git will pick up that file and start tracking it for changes. If you are using a Gui for git, the method to force and add will change based on the tool.