简体   繁体   English

如何指示git停止跟踪外部目录?

[英]how to instruct git to stop tracking outside directories?

For some reason, $ git status shows me changes to other directories: 由于某些原因, $ git status显示我对其他目录的更改:

How do I instruct git to stop tracking outside directories? 如何指示git停止跟踪外部目录?

The files aren't outside of your repository; 这些文件不在您的存储库之外; you're in a subdirectory of your repository. 您位于存储库的子目录中。

$ find
.
./subdir
./subdir/bar.txt
./foo.txt

$ git init .
Initialized empty Git repository in /tmp/ikegami/.git/

$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       foo.txt
#       subdir/
nothing added to commit but untracked files present (use "git add" to track)

$ cd subdir

$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       ../foo.txt
#       ./
nothing added to commit but untracked files present (use "git add" to track)

If your current directory is suppose to be your repository, you used git init instead of git init subdir , or you used git clone url . 如果假设当前目录是您的存储库,则使用git init而不是git init subdir ,或者使用git clone url . instead of git clone url subdir . 而不是git clone url subdir

也许这个问题尚不清楚,而您真正想要的是:

git status .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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