OpenFrameWork

오픈프레임워크_Day64

px 2015. 6. 15. 11:40
### : 목차 구분 기호
--- : 목차 내에 항목 구분 기호
@@@ : 태그 용도 
,,, : 같은 목차 내에 구분 기호

목차
1. 이론 및 정보
2. 설정 및 그 밖에
3. 소스코드 또는 실습
4. 과제

###################################
1. 이론 및 정보
-----------------------------------
* Git은 자주 해봐야 알 수 있음
금일 내용을 여러번 확인해 보기
----------------------------------- 
###################################
2. 설정 및 그 밖에
-----------------------------------
----------------------------------- 
###################################
3. 소스코드 또는 실습 
-----------------------------------
3-1

jhta@L4-01 /F/study/GitWork/GitWebProject (master)
$ git status
On branch master
nothing to commit, working directory clean

jhta@L4-01 /F/study/GitWork/GitWebProject (master)
$ git remote
origin

jhta@L4-01 /F/study/GitWork/GitWebProject (master)
$ git remote -v
origin  git@github.com:ankptilh/GitWebProject.git (fetch)
origin  git@github.com:ankptilh/GitWebProject.git (push)

jhta@L4-01 /F/study/GitWork/GitWebProject (master)
$ git push origin master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

----------------------------------- 
3-2

새로운 프로젝트

~\GitWork\ShellingFordProject\test1.txt
첫번째 작성한 문서

jhta@L4-01 /F/study/GitWork/ShellingFordProject
$ git init
Initialized empty Git repository in f:/study/GitWork/ShellingFordProject/.git/


jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git status
On branch master

Initial commit

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        test1.txt

nothing added to commit but untracked files present (use "git add" to track)


stage 상태로 올리기
jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git add test1.txt


올린 상태 확인
jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   test1.txt

만약 이상태에서 수정하면? 다시 내려옴, 실수를 줄여주기 위해서

~\GitWork\ShellingFordProject\test1.txt
첫번째 작성한 문서
첫번째 수정


jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   test1.txt

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   test1.txt

다시 add하고 상태 보기

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git add test1.txt

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   test1.txt


파일 한개 더 생성
~\GitWork\ShellingFordProject\test2.txt
두번째 파일 생성


jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   test1.txt

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        test2.txt

추가 

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git add test2.txt


추가 후 확인

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   test1.txt
        new file:   test2.txt


추가 후 test2.txt만 수정
~\GitWork\ShellingFordProject\test2.txt
두번째 파일 생성
두번째 파일 수정


jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git status
On branch master

Initial commit

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)

        new file:   test1.txt
        new file:   test2.txt


Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   test2.txt

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git commit -m "test1만 커밋함"
[master (root-commit) 3a367ee] test1만 커밋함
2 files changed, 3 insertions(+)
create mode 100644 test1.txt
create mode 100644 test2.txt

Warning: Your console font probably doesn't support Unicode. If you experience strange characters in the output, consider switching to a TrueType font such as
Lucida Console!


두 개의 파일 비교 (UTF-8로 저장을 하든지 영어로 저장해봐야겠음)

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git diff
diff --git a/test2.txt b/test2.txt
index 39be0d4..b1790b9 100644
--- a/test2.txt
+++ b/test2.txt
@@ -1 +1,2 @@
-<B5>ι<F8>° <C6><C4><C0><CF> <BB><FD><BC><BA>
\ No newline at end of file
+<B5>ι<F8>° <C6><C4><C0><CF> <BB><FD><BC><BA>
+<B5>ι<F8>° <C6><C4><C0><CF> <BC><F6><C1><A4>
\ No newline at end of file


UTF-8로 변경하고 다시 


jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git diff
diff --git a/test2.txt b/test2.txt
index 39be0d4..0993a27 100644
--- a/test2.txt
+++ b/test2.txt
@@ -1 +1,2 @@
-<B5>ι<F8>° <C6><C4><C0><CF> <BB><FD><BC><BA>
\ No newline at end of file
+<U+FEFF>두번째 파일 생성
+두번째 파일 수정
\ No newline at end of file


add하면서 commit

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git commit -a -m "add하면서 커밋"
[master 7ec8dcd] add하면서 커밋
1 file changed, 2 insertions(+), 1 deletion(-)

Warning: Your console font probably doesn't support Unicode. 
If you experience strange characters in the output, 
consider switching to a TrueType font such as
Lucida Console!

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git diff

jhta@L4-01 /F/study/GitWork/ShellingFordProject (master)
$ git status
On branch master
nothing to commit, working directory clean


----------------------------------- 
3-3

다른 사람의 repository 한번 가져오기(전부다 가져옴)

jhta@L4-01 /F/study/GitWork
$ git clone https://github.com/Dong-Hee/ridongProject.git

----------------------------------- 
3-4

기존의 github에 모든 레파지도리 지움 -> setting -> delete

로컬에 모든 프로젝트 삭제
----------------------------------- 
3-5

연습 해보기

1. github에 Test1Project 레포지터리 생성

2. 로컬에는 Test1Project 프로젝트 생성
     1) test1.txt 파일 생성(utf-8 or English)
     2) test1.txt tracked 상태로 변경
     3) test1.txt를 수정
     4) test1.txt Stage Area에 등록
     5) 현재 상태 확인
     6) 로컬 레포지터리 저장
     7) 원격 레포지터리에 업로드

3. 자신이 작업하던 Test1Project 제거

4. 서버로 부터 프로젝트(Test1Project)를 다시 복제 받아 사용할 수 있게 준비

5. 원격 레포지토리에 새로운 파일 생성(누군가가 소스를 업로드 했다고 가정)

6. 원격 레포지토리에 소스 업로드(push) 실패 확인

7. 다시 원격 서버로부터 소스 다운(pull - fetch+merge)

8. 다시 원격 레포지토리로 소스 업로드 성공 확인

----------------------------------- 
3-6

Fetch - 서버로 부터 받아옴
Merge - 내가 작업하는 소스와 합친다 

pull - 위 두개의 동작을 한번에 처리하는 명령어


github에서 파일을 추가 한다, 내용을 작성하고 (프로젝트 명 옆에 "+" 버튼)

로컬에서 파일 수정 또는 추가 후에

jhta@L4-01 /F/study/GitWork/Test1Project (master)
$ git push origin master
Username for 'https://github.com': oo1100
Password for 'https://oo1100@github.com':
To https://github.com/oo1100/Test1Project.git
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/oo1100/Test1Project.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

jhta@L4-01 /F/study/GitWork/Test1Project (master)
$ git fetch origin
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/oo1100/Test1Project
   b9b5049..c5a2a8e  master     -> origin/master

jhta@L4-01 /F/study/GitWork/Test1Project (master)
$ git pull
Updating b9b5049..c5a2a8e
Fast-forward
test2.txt | 1 +
1 file changed, 1 insertion(+)
create mode 100644 test2.txt

test1.파일 수정 후 commit -a

jhta@L4-01 /F/study/GitWork/Test1Project (master)
$ git commit -a -m "두번째 커밋..."
[master b57b4f9] 두번째 커밋...
1 file changed, 3 insertions(+), 1 deletion(-)

Warning: Your console font probably doesn't support Unicode. 
If you experience strange characters in the output, 
consider switching to a TrueType font such as
Lucida Console!

jhta@L4-01 /F/study/GitWork/Test1Project (master)
$ git push origin master
Username for 'https://github.com': oo1100
Password for 'https://oo1100@github.com':
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 318 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/oo1100/Test1Project.git
   c5a2a8e..b57b4f9  master -> master

----------------------------------- 
###################################
4. 과제
-----------------------------------
-----------------------------------
###################################
5. 과제 해결
-----------------------------------
-----------------------------------
###################################
6. 기타
----------------------------------- 
-----------------------------------