Git

Spring Legacy 프로젝트에서 사용한 .gitignore 파일

반응형

스프링 레거시... 스프링 프로젝트를 진행하면서 가장 많이 애를 먹었던 부분은 바로바로바로 깃허브 사용이다. 초기 깃이그노어 설정이 필요하긴 하지만 이렇게 어려울 일인가... 라는 생각이 많이 들었던 부분.

각 PC에서 다르게 작동할 수 있는 설정파일들과 class파일 등을 올려주어야 하는데, 캐시 문제로 gitignore를 수정해도 제대로 먹히지 않아 고생을 많이 했다. 캐시를 삭제했을 뿐인데 파일이 날아갔다거나(뭔가 다른 문제가 있었을 거라고 생각한다) 파일이 이전 소스로 버전이 떨어졌다거나(역시 뭔가 다른 문제가 아니었을까) 하는 괴상한 문제들이 중구난방으로 발생했고 깃허브에서 pull받아 실행하면 오류가 터지기 십상이라 맘고생이 가장 심했던 부분이다. 다른 블로그를 참고한 바, 아마 원격 레포와 로컬 레포가 동기화되지 않아서 벌어진 일이 아닐까... 깃은 참 유용한 툴이지만 아직도 많이 어렵다.

기본적으로 깃이그노어 생성 웹사이트에서 이클립스와 자바를 선택하여 만들었고 오류의 원인이 되는 파일들을 추가해가며 만든 결과물이다(학원 동기들 집단 지성의 결과물+현업 개발자의 조언).

# Created by https://www.toptal.com/developers/gitignore/api/eclipse,java
# Edit at https://www.toptal.com/developers/gitignore?templates=eclipse,java

mybatis-config.xml
log4j.xml

lecture
target
pom.properties
.classpath
MANIFEST.MF

### Eclipse ###
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders

# External tool builders
.externalToolBuilders/

# Locally stored "Eclipse launch configurations"
*.launch

# PyDev specific (Python IDE for Eclipse)
*.pydevproject

# CDT-specific (C/C++ Development Tooling)
.cproject

# CDT- autotools
.autotools

# Java annotation processor (APT)
.factorypath

# PDT-specific (PHP Development Tools)
.buildpath

# sbteclipse plugin
.target

# Tern plugin
.tern-project

# TeXlipse plugin
.texlipse

# STS (Spring Tool Suite)
.springBeans

# Code Recommenders
.recommenders/

# Annotation Processing
.apt_generated/
.apt_generated_test/

# Scala IDE specific (Scala & Java development for Eclipse)
.cache-main
.scala_dependencies
.worksheet

# Uncomment this line if you wish to ignore the project description file.
# Typically, this file would be tracked if it contains build/dependency configurations:
#.project

### Eclipse Patch ###
# Spring Boot Tooling
.sts4-cache/

# Eclipse Core
.project

# IDT-specific (Eclipse Java Development Tools)
.classpath

### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

# End of https://www.toptal.com/developers/gitignore/api/eclipse,java

 

캐시를 삭제하는 깃배시 명령어.

git rm -r --cached .
git add .
git commit -m "cache clear"

 

참고한 블로그. 실제로 캐시를 삭제할 때에도 아래 블로그를 참고해서 진행했다.

 

Git - 캐시(Cache) 삭제 방법 및 상세 설명

Git - Cache 삭제 설명 Git을 사용한 프로젝트 진행 중에 크리티컬한 문제는 아니지만, 신경쓰이는 두 가지 상황이 발생했습니다. 첫 번째 경우는 프로젝트와 관련 없는 private 종류의 폴더를 원격

niceman.tistory.com

 

728x90
반응형