.gitignore 설정을 깜빡하고 설정하지 않은 상태에서 git remote(GitHub)로 push 하였을 경우 삭제하는 방법
1) 삭제하기
- webstorm의 .idea 디렉토리가 GitHub에 push가 되었음
- .idea 를 삭제하자
- 명령수행 3 단계계
$ ll
total 24
-rw-r--r-- 1 nulpulum staff 59 4 6 16:04 component.css
-rw-r--r-- 1 nulpulum staff 473 4 9 09:30 component.js
-rw-r--r-- 1 nulpulum staff 633 4 9 09:30 component.html
drwxr-xr-x 12 nulpulum staff 408 4 9 09:30 ..
drwxr-xr-x 6 nulpulum staff 204 4 9 09:30 .
drwxr-xr-x 12 nulpulum staff 408 4 9 09:56 .idea
$ git rm -r --cached .idea
rm 'angularjs/component/.idea/.name'
rm 'angularjs/component/.idea/component.iml'
rm 'angularjs/component/.idea/dictionaries/nulpulum.xml'
rm 'angularjs/component/.idea/encodings.xml'
rm 'angularjs/component/.idea/jsLibraryMappings.xml'
rm 'angularjs/component/.idea/misc.xml'
rm 'angularjs/component/.idea/modules.xml'
rm 'angularjs/component/.idea/scopes/scope_settings.xml'
rm 'angularjs/component/.idea/vcs.xml'
rm 'angularjs/component/.idea/workspace.xml'
$ git commit -m "remove webstorm .idea directory"
[master 80de3cc] remove webstorm .idea directory
10 files changed, 352 deletions(-)
delete mode 100644 angularjs/component/.idea/.name
delete mode 100644 angularjs/component/.idea/component.iml
delete mode 100644 angularjs/component/.idea/dictionaries/nulpulum.xml
delete mode 100644 angularjs/component/.idea/encodings.xml
delete mode 100644 angularjs/component/.idea/jsLibraryMappings.xml
delete mode 100644 angularjs/component/.idea/misc.xml
delete mode 100644 angularjs/component/.idea/modules.xml
delete mode 100644 angularjs/component/.idea/scopes/scope_settings.xml
delete mode 100644 angularjs/component/.idea/vcs.xml
delete mode 100644 angularjs/component/.idea/workspace.xml
$ git push origin master
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 472 bytes, done.
Total 4 (delta 2), reused 0 (delta 0)
To https://github.com/ysyun/prototyping.git
cc17d3a..80de3cc master -> master
- .idea 디렉토리가 삭제되었음
- git rm 옵션들
$ git rm -r --help
usage: git rm [options] [--] <file>...
-n, --dry-run dry run
-q, --quiet do not list removed files
--cached only remove from the index
-f, --force override the up-to-date check
-r allow recursive removal
--ignore-unmatch exit with a zero status even if nothing matched
<참조>
'Git, GitHub > GitHub' 카테고리의 다른 글
[GitHub] 자신의 홈페이지를 Github에 만들기 (0) | 2013.09.07 |
---|---|
[Git] Git 메뉴얼 및 레퍼런스 목록 (0) | 2013.04.01 |
[GitHub] Fork, Pull Request 개념 (1) | 2013.01.17 |
[GitHub] Wiki에 Sidebar, Header, Footer 넣기 (0) | 2012.10.25 |