1. 개요

Git 로컬 저장소 내의 작업에 대한 내용


2. 내용

2.1. Tracked

Snapshot에 포함된 파일

2.1.1. Unmodified

2.1.2. Modified

2.1.3. Staged

2.2. Untracked

Snapshot에 포함되지 않은 파일


3. 사례

3.1. 새로운 파일을 추가

Untracked -> Staged -> Committed

3.2. 기존 파일을 수정

Unmodified -> Modified -> Staged -> Committed


4. 로컬 저장소 생성

이제 드디어 실습을 해보자.

기존 App 디렉토리를 Git 저장소로 사용하는 예다. 내가 말한 기존 App 디렉토리는 이클립스 Workspace 내 특정 프로젝트 디렉토리다.

$ git init
Initialized empty Git repository in /Users/bbparkk/Documents/workspace-sts/restest-server/.git/
$ git add.

다음은 add한 것을 commit하는 git commit 단계인데 그 전에 할 일이 있다.

이것을 하지 않으면 아래처럼 어카운트 설정을 하라는 에러가 난다.

$ git commit -m 'init'
 
*** Please tell me who you are.
 
Run
 
  git config --global user.email "이 이메일 주소가 스팸봇으로부터 보호됩니다. 확인하려면 자바스크립트 활성화가 필요합니다."
  git config --global user.name "Your Name"
 
to set your account's default identity.
Omit --global to set the identity only in this repository.

그래서 어카운트 설정을 한다. 제시된대로 글로벌로 설정했다.

$ git config --global user.email "이 이메일 주소가 스팸봇으로부터 보호됩니다. 확인하려면 자바스크립트 활성화가 필요합니다."
$ config --global user.name "bbparkk"

다시 git commit한다.

$ git commit -m 'init'
[master (root-commit) 0c4124d] init
 10 files changed, 700 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 .mvn/wrapper/MavenWrapperDownloader.java
 create mode 100644 .mvn/wrapper/maven-wrapper.jar
 create mode 100644 .mvn/wrapper/maven-wrapper.properties
 create mode 100755 mvnw
 create mode 100644 mvnw.cmd
 create mode 100644 pom.xml
 create mode 100644 src/main/java/io/sarc/springcloud/MyRestServer/MyRestServerApplication.java
 create mode 100644 src/main/resources/application.yml
 create mode 100644 src/test/java/io/sarc/springcloud/MyRestServer/MyRestServerApplicationTests.java

로컬 저장소 생성 수 리모트 저장소와 연결하는 내용은 Local Git Repository와 Remote Github 연결을 참고한다.