.gitignore를 빠르게 작성해보자!

Chai HyeonJong ·2023년 4월 5일
0

다음은 chatGPT를 활용해 작성한 글입니다.

gitignore.io는 개발자들이 Git 저장소에서 제외해야 하는 파일과 디렉토리를 지정하는 .gitignore 파일을 생성하는 무료 온라인 도구입니다. 이번에는 gitignore.io를 사용하는 방법에 대해 알아보겠습니다.


1. gitignore.io 웹사이트 방문하기

먼저, gitignore.io 웹사이트를 방문해야 합니다. 다음 URL을 브라우저에 입력하면 바로 접속할 수 있습니다.

https://www.gitignore.io/


2. 필요한 언어/도구 검색

검색창에 Git 저장소에서 제외하고 싶은 언어/도구 이름을 입력합니다. 예를 들어, Python, Java, Node 등입니다. 검색 결과에서 필요한 항목을 선택하면 됩니다.


3. .gitignore 내용 생성하기

필요한 항목을 선택하면, 우측 상단의 "Create" 버튼을 클릭합니다. 그러면 .gitignore 파일의 내용이 화면에 표시됩니다.


4. .gitignore 내용 복사하기

표시된 내용을 복사하여 프로젝트의 .gitignore 파일에 붙여넣기하면 됩니다. 이제 Git 저장소에서 제외할 파일과 디렉토리를 설정했습니다.

다음은 macOS, Visual Studio Code, Jupyter notebook, Python의 예시입니다.

# Created by https://www.toptal.com/developers/gitignore/api/macos,visualstudiocode,jupyternotebooks,python
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,visualstudiocode,jupyternotebooks,python

### JupyterNotebooks ###
# gitignore template for Jupyter Notebooks
# website: http://jupyter.org/

.ipynb_checkpoints
*/.ipynb_checkpoints/*

# IPython
profile_default/
ipython_config.py

# Remove previous ipynb_checkpoints
#   git rm -r .ipynb_checkpoints/

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
#  Usually these files are written by a python script from a template
#  before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook

# IPython

# pyenv
#   For a library or package, you might want to ignore these files since the code is
#   intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
#   However, in case of collaboration, if having platform-specific dependencies or dependencies
#   having no cross-platform support, pipenv may install dependencies that don't work, or not
#   install all needed dependencies.
#Pipfile.lock

# poetry
#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
#   This is especially recommended for binary packages to ensure reproducibility, and is more
#   commonly ignored for libraries.
#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
#   in version control.
#   https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can
#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
#  and can be added to the global gitignore or merged into this file.  For a more nuclear
#  option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

### Python Patch ###
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
poetry.toml

# ruff
.ruff_cache/

# LSP config files
pyrightconfig.json

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

# End of https://www.toptal.com/developers/gitignore/api/macos,visualstudiocode,jupyternotebooks,python

(추가) 5. .gitignore 파일 생성하기

1) 새로운 파일 생성

터미널 또는 파일 탐색기에서 Git 저장소의 루트 디렉토리로 이동합니다. 그리고 새로운 파일을 생성하고, 이름을 ".gitignore"으로 지정합니다.

2) 터미널 명령어

  • Unix/Linox & macOS
touch .gitignore
  • Windows
$ type nul > .gitignore

결론
이렇게 간단하게 gitignore.io를 사용하여 Git 저장소에서 제외할 파일과 디렉토리를 설정할 수 있습니다. 이 도구는 다양한 언어와 프레임워크, 개발 도구를 지원하며, 이를 통해 개발자들은 Git 저장소의 용량과 구성 관리를 개선할 수 있습니다.

profile
머신러닝하는 현종, 제가 공부한 것들을 기록합니다.

0개의 댓글