프로젝트 호스팅 사이트
GitHub
-무료 호스팅 공간을 제공
version control, Source control
-데이터의 과거와 현재 상태 관리하는 것.
-복수의 사람들이 사횽하는 것임.
Git
-동시 다발적인 브랜치 작업.
-Git 만들기 시작한지 3일만 Git 자체의 버전 관리 시작함.
2주무렵 처음으로 복수의 브렌치를 한번에 병합하기 시작하면서 완성됨.
-대중성 안전성 검증됨
-돈이걸린,프로로서 일하는 개발자, 디자이너와 협업
VCS
-Version Control System
git checkout
Git 설치, 셋팅
i@DESKTOP-E6G5Q1J MINGW64 ~
$ git config --list
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
i@DESKTOP-E6G5Q1J MINGW64 ~
$
명령어 리스트
i@DESKTOP-E6G5Q1J MINGW64 ~
$ git config
아이디 패스워드 초기세팅
i@DESKTOP-E6G5Q1J MINGW64 ~
$ git config --global uer.name kjh
i@DESKTOP-E6G5Q1J MINGW64 ~
$ git config --global uer.email ********@******.com
i@DESKTOP-E6G5Q1J MINGW64 ~
$ git config --list
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
pull.rebase=false
credential.helper=manager-core
credential.https://dev.azure.com.usehttppath=true
uer.name=kjh
uer.email=*********@*****.com
i@DESKTOP-E6G5Q1J MINGW64 ~
현재 디렉토리
i@DESKTOP-E6G5Q1J MINGW64 ~
$ ls -al git_tutorial/
total 12
drwxr-xr-x 1 i 197121 0 Dec 4 11:31 ./
drwxr-xr-x 1 i 197121 0 Dec 4 11:31 ../
i@DESKTOP-E6G5Q1J MINGW64 ~
$ cd git_tutorial/
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial
$ pwd
/c/Users/i/git_tutorial
쓸수 있는 상황으로
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial
$ git init
Initialized empty Git repository in C:/Users/i/git_tutorial/.git/
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ ls -al
total 16
drwxr-xr-x 1 i 197121 0 Dec 4 11:37 ./
drwxr-xr-x 1 i 197121 0 Dec 4 11:31 ../
drwxr-xr-x 1 i 197121 0 Dec 4 11:37 .git/
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$
VIM hello.java -> i키 누르면 insert
-> shift : wq하면 저장됨
파일의 내용을 보여줌
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ cat Hello.java
public class Hello{
public static void main(String[] args){
System.out.println("Hello Git!");
}
}
자바 컴파일러
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ javac Hello.java
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ java Hello
Hello Git!
기본적인 상태확인
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
.swp
Hello.class
Hello.java
nothing added to commit but untracked files present (use "git add" to track)
Stage Area에 놓는 git add 1단계
$ git add Hello.java
warning: LF will be replaced by CRLF in Hello.java.
The file will have its original line endings in your working directory
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: Hello.java
Untracked files:
(use "git add <file>..." to include in what will be committed)
.swp
Hello.class
Stage Area에 들어가 있는 상태라서 초록색표시됨
커밋 하기 2단계
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git config --global user.name kjh
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git config --global user.email chanel748596@gmail.com
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git commit Hello.java
warning: LF will be replaced by CRLF in Hello.java.
The file will have its original line endings in your working directory
[master (root-commit) 8b27e48] create Hellow.java program
1 file changed, 5 insertions(+)
create mode 100644 Hello.java
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
.swp
Hello.class
nothing added to commit but untracked files present (use "git add" to track)
누가 언제 몇시에 작업을 했는지 git log
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git log
commit 8b27e48520cb0549d468a18729bd983bbf9a8a85 (HEAD -> master)
Author: kjh <chanel748596@gmail.com>
Date: Fri Dec 4 12:25:00 2020 +0900
create Hellow.java program
브렌치 - 작업영역이 하나 더생김 작은용량으로 복제
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git branch
* master
브랜치 추가
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git branch gumi2
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git branch
gumi
gumi2
* master
브랜치 바꾸기 check out
특정 브랜치를 내 작업공간으로 가져온다.
작업영역 왔다갔다
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git checkout gumi
Switched to branch 'gumi'
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (gumi)
$
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (gumi)
$ git checkout master
Switched to branch 'master'
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$
체크아웃 브랜치 만들기 한번에 하기
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (master)
$ git branch -m gumi3
i@DESKTOP-E6G5Q1J MINGW64 ~/git_tutorial (gumi3)
$