ν˜•μƒκ΄€λ¦¬/Git

[Git] git ignore

Rainbow🌈Coder 2022. 12. 21. 14:48
728x90

https://shlee0882.tistory.com/230

 

Nodejs κΈ°λ³Έ μ„€μ •(NPM Express .gitignore μ„€μΉ˜)

1. node js μžλ°”μŠ€ν¬λ¦½νŠΈλŠ” μ›ΉλΈŒλΌμš°μ € ν”„λ‘ νŠΈμ—μ„œ κΌ­ ν•„μš”ν•œ μ–Έμ–΄μ˜€κ³ , μ›ΉλΈŒλΌμš°μ €μ— μ’…μ†μ μ΄μ—ˆλ‹€.웹에 μ’…μ†μ μ΄μ—ˆλ˜ μžλ°”μŠ€ν¬λ¦½νŠΈλ₯Ό λΆ„λ¦¬ν•˜μ—¬ μ‹€ν–‰κ°€λŠ₯ν•˜κ²Œ ν•œ 것이 nodejs이닀.nodejsλŠ” js runner

shlee0882.tistory.com

 

μ„€μ • 파일(.gitignore) 생성

.gitignore νŒŒμΌμ„ ν”„λ‘œμ νŠΈ μ΅œμƒμœ„ λ£¨νŠΈμ— μƒμ„±ν•œ ν›„

κ·Έ μ•ˆμ— 버전관리에 ν¬ν•¨ν•˜μ§€ μ•Šμ„ νŒŒμΌμ„ νŒ¨ν„΄μ— 맞게 μž‘μ„±ν•΄ μ€€λ‹€. 

  ν‘œμ€€ Glob νŒ¨ν„΄μ„ μ‚¬μš©ν•œλ‹€.

  μ•„무것도 μ—†λŠ” λΌμΈμ΄λ‚˜, "#"으둜 μ‹œμž‘ν•˜λŠ” 라인은 λ¬΄μ‹œν•œλ‹€.

  μŠ¬λž˜μ‹œ(/)둜 μ‹œμž‘ν•˜λ©΄ ν•˜μœ„ 디렉토리에 μ μš©λ˜μ§€(Recursivity) μ•ŠλŠ”λ‹€.

  λ””λ ‰ν† λ¦¬λŠ” μŠ¬λž˜μ‹œ(/)λ₯Ό 끝에 μ‚¬μš©ν•˜λŠ” κ²ƒμœΌλ‘œ ν‘œν˜„ν•œλ‹€.

  λŠλ‚Œν‘œ(!)둜 μ‹œμž‘ν•˜λŠ” νŒ¨ν„΄μ˜ νŒŒμΌμ€ λ¬΄μ‹œν•˜μ§€ μ•ŠλŠ”λ‹€.

 

<μ„€μ • μ˜ˆμ‹œ>

# ν™•μž₯μžκ°€ .a인 파일 λ¬΄μ‹œ

*.a

 

# μœ— λΌμΈμ—μ„œ ν™•μž₯μžκ°€ .a인 νŒŒμΌμ€ λ¬΄μ‹œν•˜κ²Œ ν–ˆμ§€λ§Œ lib.aλŠ” λ¬΄μ‹œν•˜μ§€ μ•ŠμŒ

!lib.a

 

# ν˜„μž¬ 디렉토리에 μžˆλŠ” TODOνŒŒμΌμ€ λ¬΄μ‹œν•˜κ³  subdir/TODO처럼 ν•˜μœ„λ””λ ‰ν† λ¦¬μ— μžˆλŠ” νŒŒμΌμ€ λ¬΄μ‹œν•˜μ§€ μ•ŠμŒ

/TODO

 

# build/ 디렉토리에 μžˆλŠ” λͺ¨λ“  파일 λ¬΄μ‹œ

build/

 

# doc/notes.txt νŒŒμΌμ€ λ¬΄μ‹œν•˜κ³  doc/server/arch.txt νŒŒμΌμ€ λ¬΄μ‹œν•˜μ§€ μ•ŠμŒ

doc/*.txt

 

# doc 디렉토리 μ•„λž˜ λͺ¨λ“  .pdf 파일 λ¬΄μ‹œ

doc/**/*.pdf

 

ignore λͺ©λ‘μ— μžˆμ–΄λ„ μΆ”κ°€(Add)ν•˜κ³  싢은 경우

-f (force) μ˜΅μ…˜μ„ μ‚¬μš©ν•˜λ©΄ λœλ‹€.

git add -f {File Name}

 

 

이미 버전관리 λŒ€μƒμ— ν¬ν•¨μžˆλŠ” νŒŒμΌμ„ μ œμ™Έν•˜κ³  싢은 경우

β€» μ•„λž˜ μž‘μ—…μ„ μˆ˜ν–‰ν•˜κΈ°μ „μ— ν˜„μž¬κΉŒμ§€ μž‘μ—…ν•œ 내역을 commit ν•˜κ³  μ§„ν–‰ν•΄μ•Όν•˜λŠ”μ§€ κ³ λ―Ό ν•„μš”

git rm -r --cached {파일λͺ…}

β–Ά μœ„ λͺ…λ Ήμ–΄λ₯Ό μ‚¬μš©ν•˜λ©΄ ν•΄λ‹Ή νŒŒμΌμ€ Untracked files μƒνƒœλ‘œ λŒμ•„κ°„λ‹€.

    λ¬΄μ‹œν•˜κ³ μž ν•˜λŠ” 파일(λ˜λŠ” 폴더)이 이미 버전 관리 λŒ€μƒμ— ν¬ν•¨λ˜μ–΄ μžˆλŠ” 경우, 

    즉, index에 포함이 λ˜μ–΄ μžˆκΈ°μ— indexμ—μ„œ ν•΄λ‹Ή 파일(λ˜λŠ” 폴더)을 μ œκ±°ν•΄μ•Ό ν•œλ‹€.

 

 

κ°€λ Ή...

 

git rm -r --cached love.js

 

git status

 

".gitignore" νŒŒμΌμ— ν•΄λ‹Ή 파일λͺ…("love.js") μΆ”κ°€

 

git status

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

https://zoosso.tistory.com/835

 

[Git] .gitignore μ„€μ •

.gitignore μ„€μ • git은 변경점을 좔적을 μΆ”μ ν•˜λŠ”λ°, νŠΉμ • νŒŒμΌλ“€μ„ λ¬΄μ‹œ(ignore)ν•˜μ—¬ μΆ”μ ν•˜μ§€ μ•Šκ²Œ ν•  수 μžˆλ‹€. β–Ά Log νŒŒμΌμ΄λ‚˜ Build 섀정은 관리 λŒ€μƒμ—μ„œ μ œμ™Έ μ²˜λ¦¬ν•  수 μžˆλ‹€. ex) Intellij IDEμ—μ„œ 각

zoosso.tistory.com

 

 

κ²Œμž„ μͺ½ κΉƒμ΄κ·Έλ…ΈλŠ” 이정도

node_modules
package-lock.json
docs
assets
728x90