Git - change some files

When I try to pull my local repository into an empty remote repository, I do the following:

git add . git status 

When im running git status , I see that some files are not supplied, here is a screenshot of my git bash and my local working copy:

Screeshot of git bash and my local working copy.

My ignore file:

 *.* #####Directories !CefSharp/Internals/* !CefSharp/Properties/* !CefSharp.BrowserSubprocess/Properties/* !CefSharp.Core/Internals/* !CefSharp.Core/Win32/* !CefSharp.Example/ExtensionMethods/* !CefSharp.Example/Properties !CefSharp.Example/Proxy !CefSharp.Example/Resources !CefSharp.WinForms/Internals/* !CefSharp.WinForms/Properties/* !CefSharp.WinForms.Example/Minimal/* !CefSharp.WinForms.Example/Properties/* !CefSharp.WinForms.Example/Resources/* !CefSharp.WinForms.Example/Tools/* !ipch/* !packages/* !Resources/* !RexCao/Properties/* !SysHandle/Properties/* !TimesheetUpdater/Properties/* !TimesheetUpdater/Resources/* !TimesheetUpdater/Tools/* !TSNetChecker/Properties/* !TSNetChecker/Resource/* !TSNetChecker/Resources/* !TSNetChecker/Tools/* !UIThreadTest/Properties/* !Win32/* #####Files !CefSharp/*.cs !CefSharp/*.csproj !CefSharp.BrowserSubprocess/app* !CefSharp.BrowserSubprocess/*.csproj !CefSharp.BrowserSubprocess/*.cs !CefSharp.BrowserSubprocess.Core/*.cpp !CefSharp.BrowserSubprocess.Core/*.h !CefSharp.BrowserSubprocess.Core/*.vcxproj.* !CefSharp.BrowserSubprocess.Core/*.config !CefSharp.Core/*.cpp !CefSharp.Core/*.h !CefSharp.Core/*.vcxproj.* !CefSharp.Core/*.config !CefSharp.Example/*.cs !CefSharp.Example/*.csproj !CefSharp.WinForms/*.csproj !CefSharp.WinForms/*.cs !CefSharp.WinForms.Example/*.cs !CefSharp.WinForms.Example/app.* !CefSharp.WinForms.Example/*.csproj.* !CefSharp.WinForms.Example/*.ico !CefSharp.WinForms.Example/*.config !CefSharp.WinForms.Example/*.resx !RexCao/*.cs !RexCao/*.csproj !SysHandle/*.cs !SysHandle/*.csproj !TimesheetUpdater/*.ico !TimesheetUpdater/*.cs !TimesheetUpdater/*.resx !TimesheetUpdater/*.csproj !TSNetChecker/*.cs !TSNetChecker/*.resx !TSNetChecker/*.ico !TSNetChecker/*.csproj !UIThreadTest/*.config !UIThreadTest/*.cs !UIThreadTest/*.resx !UIThreadTest/*.csproj !.gitignore !*.ps1 !*.yml !*.bat !*.props !*.snk !*.sdf !*.sln 

My question is: why were some files skipped?

+2
source share
3 answers

To include all files in a directory, you must specify it as:

 !directory/** 

not with one asterisk ( * ).

Since you indicated to ignore all files

 *.* 

except for those that you included with bang ( ! ), you must correctly specify the files you want to add.

Background

As you can read in the specification , one asterisk corresponds to files directly in the directory. Not files in subdirectories.

In order not to ignore all the files in the directory, you need to use two consecutive asterisks:

Two consecutive asterisks (" ** ") in patterns mapped to full paths may have special meaning:

  • The leading " ** " followed by a slash in all directories. For example, “ **/foo ” matches the file or directory “foo” anywhere, the same as the template “ foo ”. " **/foo/bar " corresponds to the file or directory " bar " somewhere just below the directory " foo ".

  • The final " /** " matches everything inside. For example, " abc/** " matches all files inside the " abc " directory with respect to the location of the .gitignore file with infinite depth.

  • A slash followed by two consecutive asterisks, then a slash corresponds to zero or more directories. For example, " a/**/b " matches " a/b ", " a/x/b ", " a/x/y/b ", etc.

Other consecutive sprockets are considered invalid.

+2
source

Git add does not contain ammo from files in the index.

Please, use

 git add . --all 

include all files and delete deleted ones.

+1
source

Are you trying to add empty directories?
Git won't let you if you haven't installed content in these folders? Add an empty .gitkeep file to the folder and it will be added

Ignored files
You have verified that the ignored files are not installed in the global ignore file.

Are you trying to add deleted / renamed files?
git add -A (replacement for git add.; git add -u . )

0
source

All Articles