2016-05-17 42 views
0

我是git的新手,已經完成了多個小練習軌道項目。我最近開始了一個教程,並且git表現得很時髦。我創建了一個新分支,並使用與我在另一個項目分支中使用的名稱相同的名稱。它開始引用我在該項目中所做的所有更改,但引用了我的新項目。我通過盲目添加和承諾來解決這個問題。但是現在,當我在新項目的主分支中執行git狀態時,我收到了未跟蹤的文件消息。有些文件引用了我的文明遊戲。Git中未記錄的文件問題

在完成git add -A之後,我做了一個git狀態,並且吐出了一百萬行參考youtube的紅色文本。我做了一個git reset來反轉。

我的問題:我該如何解決這個問題?爲什麼在一個全新的項目中,git狀態引用會從我的計算機上的其他項目和應用程序中更改?

On branch master 
Untracked files: 
    (use "git add <file>..." to include in what will be committed) 

    ../../../.CFUserTextEncoding 
    ../../../.Trash/ 
    ../../../.bash_history 
    ../../../.bash_profile 
    ../../../.bash_sessions/ 
    ../../../.bashrc 
    ../../../.bundle/ 
    ../../../.config/ 
    ../../../.gem/ 
    ../../../.gemrc 
    ../../../.gitconfig 
    ../../../.heroku/ 
    ../../../.irb-history 
    ../../../.matplotlib/ 
    ../../../.mkshrc 
    ../../../.netrc 
    ../../../.node_repl_history 
    ../../../.profile 
    ../../../.rvm/ 
    ../../../.ssh/ 
    ../../../.subversion/ 
    ../../../.viminfo 
    ../../../.zlogin 
    ../../../.zshrc 
    ../../../Applications/ 
    ../../.localized 
    ../../Bomb/ 
    ../../Conditionals.playground/ 
    ../../Desktop/ 
    ../../Dev/ 
    ../../Exercise.playground/ 
    ../../Green_guy.html 
    ../../Green_guy_style.css 
    ../../Hartl/ 
    ../../Hello World/ 
    ../../Mathops.playground/ 
    ../../Screen Shot 2016-02-08 at 9.14.15 PM.png 
    ../../Sid Meier's Civilization V.app/ 
    ../../SuperCool/ 
    ../../Terminal.app/ 
    ../../Variables.playground/ 
    ../../another-git-test/ 
    ../../arrays.playground/ 
    ../../auto-layout-advanced/ 
    ../../auto-layout-test/ 
    ../../autolayout-pratice/ 
    ../../autolayout/ 
    ../../autolayoutconstrants/ 
    ../../boston/ 
    ../../cw.py 
    ../../cw.rb 
    ../../function.playground/ 
    ../../git-fun/ 
    ../../google_logo.jpg 
    ../../googlepage.css 
    ../../googlepage.html 
    ../../lesson_3 (old)/ 
    ../../logo.jpg 
    ../../loops.playground/ 
    ../../multiples-project/ 
    ../../numbers.playground/ 
    ../../practice/ 
    ../../practicePush/ 
    ../../project/ 
    ../../rails/ 
    ../this/ 
    ../../sample.pdf 
    ../../scrape.py 
    ../../scraper.py 
    ../../stackview.playground/ 
    ../../stackview/ 
    ../../tapper/ 
    ../../test.html 
    ../../test_post/ 
    ../../../Documents/ 
    ../../../Downloads/ 
    ../../../Library/ 
    ../../../Movies/ 
    ../../../Music/ 
    ../../../Pictures/ 
    ../../../Public/ 
    ../../../google-homepage/ 
    ../../../railsbridge/ 

nothing added to commit but untracked files present (use "git add" to track) 
-MacBook-Air:lesson-3 wick$ git add -A 
+0

,一切都顯示爲未跟蹤。找到並刪除.git文件夾 – zee

回答

0

您已經在顯示的文件夾下初始化了git。

一旦你執行git init而沒有參數正在當前目錄下創建一個git倉庫。

如果你想在不同的目錄中創建一個Git倉庫,你必須提供存儲庫名稱:git init <repo name>

How can I resolve this?

只需刪除.git文件夾及其內容和該文件夾將不再會被跟蹤git

爲什麼在一個全新的項目中,git狀態引用會從我的計算機上的其他項目和應用程序中更改?

由於您已經初始化當前目錄中的git。


git init - 創建一個空的Git倉庫或重新初始化你有,因此你的項目的根目錄下的某個地方初始化git的現有

+0

謝謝。我如何找到.git文件夾? – staredecisis

4

您的主目錄中有一個.git文件夾。

因此,您的homedir下的所有內容都將被視爲一個巨型存儲庫的一部分。你可能偶然從錯誤的地方運行了「git init」。

刪除錯誤的.git文件夾。

+1

...並通過從其運行'git init'在正確的forlder中創建一個 – user3159253