코딩 연습/Github

깃에서 필요 없는 것 빼기

쵸잇 2018. 10. 11. 17:17

깃허브에 파일을 올리기 전에 커밋되지않은 파일을 확인한다.


1
git status
cs


입력을 하면


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
On branch master
 
No commits yet
 
Untracked files:
  (use "git add <file>..." to include in what will be committed)
 
        .gitignore
        README.md
        blog/
        db.sqlite3
        feed/
        manage.py
        requirements.txt
        static/
        templates/
 
nothing added to commit but untracked files present (use "git add" to track)
cs


다음과 같이 출력이 되는데, 우리는 db.sqlite3까지 굳이 커밋해줄 필요가 없다. 대용량이기도 하고.

그렇다고 삭제할 순 없으니 .gitignore을 활용해 파일을 숨길 수 있다.


1
echo db.sqlite3 >> .gitignore
cs


입력하면 .gitignore 파일을 만들어 db.sqlite3를 리스트에 등록한다.


다시 git status를 하면


1
2
3
4
5
6
7
8
9
10
Untracked files:
  (use "git add <file>..." to include in what will be committed)
 
        .gitignore
        blog/
        feed/
        manage.py
        requirements.txt
        static/
        templates/
cs


다음과 같이 보이지 않게 된다.