87
버전관리시스템 종류와 소개

버전관리시스템 종류와 소개

Embed Size (px)

Citation preview

버전관리시스템 종류와 소개

KGUG 소개https://www.facebook.com/groups/kgugs/

1000+ Members !!!

https://www.flickr.com/photos/alshepmcr/4298593016

+Github

@daclouds_

석종일 Programmer

“우리����������� ������������������  친하게����������� ������������������  지내요~����������� ������������������  >_<“

버전관리*• 파일의 변화를 시간에 따라 기록하는 것

6 seconds ago

1 minutes ago

7 minutes ago

13 minutes ago

1 month ago

문서 작성

시간

내용

제출

자료구조_리포트자료구조_리포트

??

http://icons8.com/

Stop emailing code

https://education.github.com/assets/illustration-share-code-f8d1d0ad9fceca0fc5156dea4ab0eb14.png

수정되면 파일명 바꾸기

시간

내용

자료구조_리포트_v1

자료구조_리포트_v2

자료구조_리포트_v3

!

파일이 날아갔다면?

X

파일 이름 바꾸기

이전 버전으로 되돌릴 수 없다

Never lose your work

자료구조_리포트_v1 자료구조_리포트_v2 자료구조_리포트_v3

이전 파일 보관

파일 비교아이유 - Voice Mail 가사

Git

Github

파일 이름 바꾸기

이전 버전 파일도 보관 파일의 중복이 발생

파일을 비교할 수 있다

폴더가 늘어났다면?

엄청난 중복이 발생합니다.

dropbox 나 google drive 를 이용하는 것도 버전관리를 할 수 있는 좋은 방법이에요

하지만 파일 하나가 아니라여러 개의 파일을 묶어서 관리하고 싶다면?

파일 이름 바꾸기

이전 버전 파일도 보관

파일 이력 관리파일 사이의 연관 관계를 찾기 어렵다

시간에 따라 정리

어느 쪽이 알아보기 쉬운가요?

• 2014-12-20 13:30

• 2014-12-20 11:59

• 2014-12-19 19:24

• 2014-12-17 14:33

• 2014-12-11 23:15

• …

• Commit, Issue 용어 설명

• VCS 종류별 장단점

• git 기본 명령어와 중복된 내용 제거

• 저작권 관련 표기

• vim 배우기

• …

Commit 제목, 내용, 시간, 작성자

Issue

Commit

Commit

Commit

Stay organized

https://education.github.com/assets/illustration-one-place-ea4a5f0e6cb2e72e9630fa1cc50119dd.png

이런 문제를 해결할 방법이 없을까?

https://www.flickr.com/photos/23679420@N00/545653437

버전관리시스템

로컬 중앙집중형 분산형*

http://git-scm.com/book/en/v2/Getting-Started-About-Version-Control

로컬 버전관리시스템

중앙집중형 버전관리시스템

https://mikiorbe.files.wordpress.com/2008/10/cvsbig.gif, https://subversion.apache.org/

http://git-scm.com/book/en/v2/Getting-Started-About-Version-Control

X중앙집중형 버전관리시스템

파일 이름 바꾸기

이전 버전 파일도 보관

파일 버전 관리

중앙집중형 버전 관리

서버가 죽으면 아무것도 할 수 없다

http://git-scm.com/book/en/v2/Getting-Started-About-Version-Control

분산형 버전관리시스템

http://mercurial.selenic.com/http://git-scm.com/

https://github.com/

https://octodex.github.com/original/

https://bitbucket.org/

Linux, Git

Git 의 목표

• 빠른 속도

• 단순한 구조

• 비선형적 개발 (수천 개의 동시 다발적인 브랜치)

• 완벽한 분산

• 리눅스 커널 같은 대형 프로젝트에서도 속도나 데이터 크기 면에서 유용 할 것

You can code whether the network is down

commit

Git 의 무결성

• Git 은 SHA-1 Hash 를 사용하여 체크섬을 만듭니다.

• 만든 체크섬은 40자 길이의 16진수 문자열입니다.

• SHA-1 은 아래처럼 생겼어요.

• 24b9da6552252987aa493b52f8696cd6d3b0

파일 이름 바꾸기

이전 버전 파일도 보관

파일 버전 관리

중앙집중형 버전 관리

분산형 버전 관리

Linux 명령어 배우기• > mkdir numbers

• numbers 라는 이름의 디렉토리를 만들 때

• > mkdir -p numbers/txt

• numbers 디렉토리가 없는 상황에서 numbers 와 numbers 밑에 txt 디렉토리를 한꺼번에 만들 때

hunk• - 변경 단위

• 앞의 상황은 서로 다른 hunk 가 변경되었기 때문에 아무런 문제가 발생하지 않습니다.

동일한 위치에서 수정•@@ -4,7 +4,7 @@

• 넷

• 다섯

• 여섯

•-일곱

•+lucky

•@@ -4,7 +4,7 @@

• 넷

• 다섯

• 여섯

•-일곱

•+7

충돌 발생!• $ git merge luckyAuto-merging numbers.txtCONFLICT (content): Merge conflict in numbers.txtAutomatic merge failed; fix conflicts and then commit the result.

vim 배우기• 편집 모드

• i (입력), a (추가)

• 입력 모드를 빠져나올 때

• ESC

vim 배우기• 명령어 모드

• :

• 빠져 나오기

• ESC

• 저장하기

• :w

• vim 종료

• :q

• 저장하고 나오기

• :wq

• 저장하지 않고 나오기

• :q!

• # Rebase bdd3996..7b36971 onto bdd3996 ## Commands:# p, pick = use commit # r, reword = use commit, but edit the commit message# e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit# f, mixup = like “squash”, but discard this commit’s log message# x, exec = run commond (the rest of the line) using shell## If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted.#~

• pick d3672b0 replace 일곱 to 7pick 6b2481b replace 둘 to 2pick fa39187 1 to 10

• pick d3672b0 replace 일곱 to 7squash 6b2481b replace 둘 to 2pick fa39187 1 to 10

Commit 합치기/순서 바꾸기

Commit Messages 수정• # This is a combination of two commits.# The first commit's message is:replace 둘 to 2# This is the 2nd commit message:replace 일곱 to 7# Please enter the commit message for your changes. Lines starting# with '#' will be ignored, and an empty message aborts the commit.# Not currently on any branch.# Changes to be committed:# (use "git reset HEAD <file>..." to unstage) ## modified: numbers.txt #

https://help.github.com/articles/using-git-rebase/

왜 그래야 하는데!?

• 왜냐하면 우리의 목적은..

• 파일의 변화를

• 의미있는 단위로 묶어서

• 그들의 선후 관계를

• 기록하는 것 X

기억을 하기 위해선…• 기록을 해야합니다. 무엇이 필요할까요?

• 작성된 시간

• 작성자

• 혼자서 작성할 때는 필요없지만 여럿이 작성한다면 필요합니다.

• 제목

• 내용이 길 경우엔 내용을 함축할 수 있는 짤막한 요약이 도움이 됩니다.

• 내용

Commit Guidelines• 영문 50글자 이하의 간략한 수정 요약

• 자세한 설명. 영문 72글자 이상이 되면 줄 바꿈을 하고 이어지는 내용을

• 작성한다. 특정 상황에서는 첫 번째 줄이 이메일 메시지의 제목이 되고

• 나머지는 메일 내용이 된다. 간략하게 요약하고 넣는 빈 줄은 자세한

• 설명을 아예 쓰지 않는 한 매우 중요하다.

• 이어지는 내용도 한 줄 띄우고 쓴다.

• - 목록 표시도 사용할 수 있다.

• - 보통 '-' 나 '*' 표시를 사용해서 목록을 표현하고 표시 앞에 공백

• 하나, 각 목록 사이에는 빈 줄을 하나를 넣는데 상황에 따라 다르다.

message 작성 (git commit)

의미있는 단위의 커밋은 문제의 원인을 파악하는데 도움이 됩니다. (git blame)

- Console 에서만 되나요?- Linux 나 Mac 이 있어야 하나요?

You name it We have it

지금부터..

몇 가지 git 명령어를 몇 가지 도구들을 사용하여 실습하는 것을 보여 줄 꺼에요

물론 이후에 이어지는 실습도 같은 방식으로 할 수 있습니다.

하지만 이후 실습은 CLI 로만 보여 줄 꺼에요;

아닙니다!

http://www.eclipse.org/egit/ https://visualstudiogallery.msdn.microsoft.com/

abafc7d6-dcaa-40f4-8a5e-d6724bdb980c

http://git-scm.com/downloads/guis

http://ergoemacs.org/emacs/emacs_magit-mode_tutorial.html

https://github.com/gregsexton/gitv

하지만 CLI 도구를 익히는걸 추천합니다!!

https://progit.org/

https://images-na.ssl-images-amazon.com/images/I/51yUrziP2fL._SL250_.jpghttp://www.insightbook.co.kr/wp-content/uploads/2013/04/표지-235x300.jpg

https://education.github.com/pack

숙제(code)를 공유하는 가장 쉬운 방법!

선생님은 숙제 (template)를 내주고 학생들은 숙제를 (fork) 받아서 문제를 풀고 제출 (pull request) 한다.

git 저장소를 hosting 하는 서비스들(github, bitbucket, …)의 wiki 는.. git 저장소 처럼 동작합니다. (응?)

history 보기 기능

author, commit, message 그리고 date 가 있다!

문서를 git 저장소로 관리하기도 합니다.

git 설정• 맥에서는 터미널, 윈도우에서는 Git Bash 창에서

• $ git config --global user.name "John Doe"

• $ git config --global user.email [email protected]

log alias• $ git config --global alias.lg "log --all --oneline --decorate --graph"

• 다음 명령으로 확인

• $ git config --global --list

ssh 설정• http://git-scm.com/book/ko/v1/Git-서버-공개키-만들기

• $ ssh-keygenGenerating public/private rsa key pair. Enter file in which to save the key (/Users/schacon/.ssh/id_rsa):Enter passphrase (empty for no passphrase): Enter same passphrase again:Your identification has been saved in /Users/schacon/.ssh/id_rsa. Your public key has been saved in /Users/schacon/.ssh/id_rsa.pub.The key fingerprint is:43:c5:5b:5f:b1:f1:50:43:ad:20:a6:92:6a:1f:9a:3a [email protected]

public key 확인• $ cat ~/.ssh/id_rsa.pub

• ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSUGPl…NrRFi9wrf+M7Q== [email protected]

github public key 등록

Build a portfolio

https://education.github.com/assets/illustration-contribute-6f244f162a35a823a61731656b901fe6.png

꾸준히 코딩하고 자신의 작업을 뽑내세요~

• KGUG(https://www.facebook.com/groups/kgugs/)의 Git 교육을 위해 만든 이 교육자료는크리에이티브 커먼즈 [저작자표시-비영리-동일조건변경허락 4.0]에 따라 이용할 수 있습니다.

• 자세한 내용은 http://creativecommons.org/licenses/by-nc-sa/4.0/deed.ko 를 참고하세요.

• twitter: @daclouds_email: [email protected]