git rm -r --cached . git add . git commit -m 'update .gitignore' 注意: 不要误解了 .gitignore 文件的用途,该文件只能作用于 Untracked Files,也就是那些从来没有被 Git 记录过的文件(自添加以后,从未 add 及 commit 过的文件)。
$git check-ignore -v App.class.gitignore:3:*.classApp.class 4. exclude文件 exclude文件在 ,exclude文件跟 .ignore文件的效果类似,都可以忽略掉某些文件。不同点在于 exclude文件位于当前项目的 .git/info/exlude目录下, .gitignore文件位于 当前项目的根目录下 exclude文件只在本地有效,无法git add,跟别人...
需要注意的是:如果在上次执行“git add”之后再对文件的内容进行了修改,那么在执行“git status”命令时,Git会对文件内容进行SHA1哈希运算就会发现文件又被修改了,仍会提示需要add,这是因为SVN是追加式的,只需要add一次;而GIT每次修改后的提交都是新文件,所以需要重新add。其实这时“readme.txt“就同时呈现了两个...
简单来说一个场景:在你使用git add .的时候,遇到了把你不想提交的文件也添加到了缓存中去的情况,比如项目的本地配置信息,如果你上传到Git中去其他人pull下来的时候就会和他本地的配置有冲突,所以这样的个性化配置文件我们一般不把它推送到git服务器中,但是又为了偷懒每次添加缓存的时候都想用git add .而不是手...
git add -u 再次查看状态: 代码语言:txt 复制 git status # 输出可能类似于: # On branch master # Changes to be committed: # (use "git restore --staged <file>..." to unstage) # modified: file1.txt # modified: file2.txt # # Untracked files: # (use "git add <file>..." t...
git clean 参数-q,--quietdonot print names of files removed-n,--dry-run dry run-f,--force force-i,--interactive interactive cleaning-dremovewhole directories-e,--exclude<pattern>add<pattern>to ignore rules-xremoveignored files,too 也删除被忽略的文件-Xremoveonly ignored files 仅删除被忽略的...
Specifies the pathname to the file that contains patterns to describe paths that are not meant to be tracked, in addition to .gitignore (per-directory) and .git/info/exclude. Defaults to $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ig...
本地仓库的文件忽略规则可以在.git/info/exclude文件中添加。这些忽略的文件不会提交到共享库中,因而不会被协作者所共享。 # git ls-files --others --exclude-from=.git/info/exclude # Lines that start with '#' are comments. # For a project mostly in C, the following would be a good set of...
git ls-files -o -i -X .gitignore仅查看 ignored 的文件,匹配模式从 .gitignore 文件中获取(--others,--ignored,--exclude-from)。了解git ls-files。 git status --ignored也会列出 ignored 的文件;了解git status。 git ls-files -o --directory可以查看非受控文件和目录列表(--others)。
Debug gitignore / exclude files git-check-mailmap[1] Show canonical names and email addresses of contacts git-check-ref-format[1] Ensures that a reference name is well formed git-column[1] Display data in columns git-credential[1]