2014-06-13 108 views
0

出于某种原因,$ git status显示我更改为其他目录:如何指示git停止跟踪外部目录?

如何指导混帐停止跟踪之外的目录?

+0

如果他们跟踪,他们显然不是外面的什么曲目。 – ikegami

+0

听起来像你从不同于你想从其中执行的目录中的'git init .'或'git clone .'。 – ikegami

+0

您必须位于存储库的子目录中。 'git status'显示任何文件的相对路径。 – knittl

回答

2

这些文件不在您的存储库之外;你在你的仓库的子目录中。

$ 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) 

如果当前目录是假设是你的仓库,你使用git init代替git init subdir,或者你使用git clone url .代替git clone url subdir

1

也许问题不明确,你真正想要的是:

git status .