[英]git rm --cached is removing files from file system
我已經開始研究項目,並且已經將.idea/*
添加到.gitignore文件中,但是它仍然顯示出來。
因此,我認為該文件必須位於git緩存中,因此我運行了git rm --cached filename
,盡管由於合並分支時實際上刪除了該文件,所以它似乎不起作用,您可以在下面看到我的git命令。
在使用ubuntu之前,我最近開始使用macbook pro進行開發,但從未遇到過這個問題。 也許這與我的git
設置有關。
這是在另一個項目之前發生的,那一次是我運行git rm --cached .
它實際上從文件系統中刪除了大多數項目文件。
$ (786-rwd) git status
On branch 786-rwd
Your branch is up-to-date with 'origin/786-rwd'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: .idea/misc.xml
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitignore
modified: .idea/modules.xml
modified: .idea/www.project.dev.iml
modified: app/design/frontend/bootstrapped/rwd/template/prog/bund.phtml
Untracked files:
(use "git add <file>..." to include in what will be committed)
skin/frontend/bootstrapped/rwd/sass/_cms-pages.scss
holy in ~/ubuntu_1404/httpdocs/porject
$ (786-rwd) git rm --cached .idea/modules.xml
rm '.idea/modules.xml'
holy in ~/ubuntu_1404/httpdocs/porject
$ (786-rwd) git rm --cached .idea/www.project.dev.iml
rm '.idea/www.project.dev.iml'
$ (786-rwd) git status
On branch 786-rwd
Your branch is up-to-date with 'origin/786-rwd'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: .idea/misc.xml
deleted: .idea/modules.xml
deleted: .idea/www.project.dev.iml
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: app/design/frontend/bootstrapped/rwd/template/prog/bund.phtml
Untracked files:
(use "git add <file>..." to include in what will be committed)
skin/frontend/bootstrapped/rwd/sass/_cms-pages.scss
holy in ~/ubuntu_1404/httpdocs/porject
$ (786-rwd) ls .idea/
./ .name deployment.xml encodings.xml scopes/ workspace.xml
../ copyright/ dictionaries/ modules.xml vcs.xml www.project.dev.iml
$ (786-rwd) git add .
holy in ~/ubuntu_1404/httpdocs/project
$ (786-rwd) git commit -m 'theming & cleaned up git'
[786-rwd 8aa5ba8] theming & cleaned up git
5 files changed, 24 deletions(-)
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/modules.xml
delete mode 100644 .idea/www.project.dev.iml
create mode 100644 skin/frontend/bootstrapped/rwd/sass/_cms-pages.scss
holy in ~/ubuntu_1404/httpdocs/project
$ (786-rwd) git status
On branch 786-rwd
Your branch is ahead of 'origin/786-rwd' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
holy in ~/ubuntu_1404/httpdocs/project
$ (786-rwd) git checkout -b test-branch origin/prod
Branch test-branch set up to track remote branch prod from origin.
Switched to a new branch 'test-branch'
holy in ~/ubuntu_1404/httpdocs/project
$ (test-branch) git merge --no-ff 786-rwd
Auto-merging app/design/frontend/bootstrapped/mobile/template/program/results.phtml
Auto-merging app/design/frontend/bootstrapped/default/template/page/html/header.phtml
Removing .idea/www.project.dev.iml
Removing .idea/modules.xml
Removing .idea/misc.xml
Merge made by the 'recursive' strategy.
.gitignore | 6 +-
.idea/misc.xml | 5 -
.idea/modules.xml | 9 -
.idea/www.project.dev.iml | 9 -
app/design/frontend/bootstrapped/default/layout/local.xml | 66 ++++
$ (test-branch) ls .idea/
./ ../ .name copyright/ deployment.xml dictionaries/ encodings.xml scopes/ vcs.xml workspace.xml
rm --cached
將在登台區域中將文件標記為已刪除。 下次提交時,刪除將記錄在存儲庫的歷史記錄中。 如果您隨后將此提交合並到另一個分支,則將從磁盤中刪除該文件(因為Git合並了您的分支,然后檢出了結果樹)。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.