김기헌
Git이란?
소스 코드를 효율적으로 관리하기 위해 만들어진 “분산형 버전 관리 시스템”이다.
why? Git을 왜 사용하는가?
•
소스 코드의 변경 내역을 확인하기 쉬움
•
특정 시점에 저장된 버전과 비교가 용이함
•
특정 시점으로 되돌아갈 수 있음
•
같은 파일을 여러 명이 동시에 작업하는 병렬 개발 가능
Git vs GitHub
Git은 분산형 버전 관리 “시스템”이고 GitHub는 Git 저장소를 관리하는 클라우드 기반 호스팅 서비스이며, 클라우드 서버를 사용하여 로컬에서 버전 관리한 소스코드를 업로드 하여 공유, 분산 버전 제어 등등이 가능한 “서비스”이다.
GitHub와 같은 웹 호스팅 시스템으로는 GitLab, BitBucket 등이 있다.
Repository
파일이나 폴더를 저장해두는 곳으로 2가지로 나뉜다.
•
Local Repository: 내 PC에 저장되는 개인 저장소(데스크탑, 노트북 등등)
•
Remote Repository: 원격 저장소로 전용 서버에 저장되는 저장소
Branch
작업을 독립적으로 만들기 위한 개념으로 각각의 브랜치는 다른 브랜치의 영향을 받지 않아 여러 작업을 동시에 진행할 수 있다.
또한 다른 브랜치와 병합함으로써, 작업한 내용을 다시 새로운 하나의 브랜치로 모을 수 있다.
즉, 여러 사람이 동시에 작업을 할 때, 서로의 작업에 영향을 주고 받지 않도록 하기 위해 메인 브랜치에서 각자의 작업 전용 브랜치를 만들어 각자의 작업을 진행 후, 메인 브랜치에 자신의 변경 사항을 적용하면서 합칠 수 있다.
Git 기초 용어, 명령어
•
commit: 변경 사항을 로컬 저장소에 기록하는 것
•
push: commit한 내용을 원격 저장소에 업로드 하는 것
•
head: 현재 작업중인 Branch
•
merge: 다른 Branch의 내용을 현재 Branch로 가져와 합치는 작업
•
git init: 깃 저장소 초기화
•
git status: 저장소의 상태를 확인. 커밋이 필요한 변경사항이 있는지, 어떤 브랜치에서 작업하고 있는지 등 확인 가능
•
git clone: 원격 저장소의 내용을 내 local 저장소에서 이용할 수 있게 복사해 가져오는 것.
김상호
Git 이란?
형상 관리 도구 중 하나로, 컴퓨터 파일의 변경사항을 추적하고 여러 명의 사용자들 간에 해당 파일들의 작업을 관리하기 위한 분산 버전 관리 시스템
Git 을 쓰는 이유는?
소스코드를 따로 주고 받을 필요 없이 Git을 사용해 병렬적인 개발이 가능하기 때문!
Git의 다양한 명령어들 모음집
SourceTree
그렇다면 SourceTree를 사용하는 이유는 무엇일까?
장점: 누구보다 빠른 merge 가능 (다양한 계정의 레퍼지토리를 왔다 갔다 하기 편하다)
단점: 프로젝트 크기가 커지면 버벅거릴 수 있음
Codeup 1007번 코드
윈도우 운영체제의 파일 경로를 출력하는 연습을 해보자.
파일 경로에는 특수문자들이 포함된다.
다음 경로를 출력하시오.
"C:\Download\hello.cpp"
(단, 큰따옴표도 함께 출력한다.)
public class codeup1007 {
public static void main(String[] args) {
System.out.println("\"C:\\Download\\hello.cpp\""); // ", \ 는 \를 통해 출력 가능
}
}
Plain Text
복사
Codeup 1008번 코드
키보드로 입력할 수 없는 다음 모양을 출력해보자. <유니코드 사용>
(** 참고 : 운영체제의 문자 시스템에 따라 아래와 같은 모양이 출력되지 않을 수 있다.)
┌┬┐
├┼┤
└┴┘
class codeup1008 {
public static void main(String[] args) {
System.out.println("\u250C\u252C\u2510");
System.out.println("\u251C\u253C\u2524");
System.out.println("\u2514\u2534\u2518");
}
}
Plain Text
복사
Codeup 1010번 코드
정수형(int)으로 변수를 선언하고, 변수에 정수값을 저장한 후
변수에 저장되어 있는 값을 그대로 출력해보자.
import java.util.Scanner;
public class codeup1010 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); // 스캐너 사용
int a = sc.nextInt();
System.out.println(a);
}
}
Plain Text
복사
이가현
GIT
개발한 분산형 버전 관리 시스템 (VCS)
GITHUB
버전 관리와 협업을 위한 코드 웹 호스팅 플랫폼으로, 언제, 어디서나 협업 프로젝트를 쉽게 진행할 수 있도록 돕는 역할
GITHUB 명령어
화폐단위로 몫,나머지 구하기
public class CurrencyAlgorithm {
public static void main(String[] args) {
int refund = 125650;
int curr50000 = 50000;
int curr10000 = 10000;
int curr5000 = 5000;
int curr1000 = 1000;
int curr500 = 500;
int curr100 = 100;
int curr50 = 50;
System.out.printf("5만원권 %d장 나머지:%d\n", refund / curr50000, refund % curr50000);
refund = refund % 50000;
System.out.printf("1만원권 %d장 나머지:%d\n", refund / curr10000, refund % curr10000);
refund = refund % 10000;
System.out.printf("5천원권 %d장 나머지:%d\n", refund / curr5000, refund % curr5000);
refund = refund % 5000;
System.out.printf("1천원권 %d장 나머지:%d\n", refund / curr1000, refund % curr1000);
refund = refund % 1000;
System.out.printf("5백원권 %d장 나머지:%d\n", refund / curr500, refund % 500);
refund = refund % 500;
System.out.printf("100원권 %d장 나머지:%d\n", refund / curr100, refund % curr100);
refund = refund % 100;
System.out.printf("50원권 %d장 나머지:%d\n", refund / curr50, refund % curr50);
}
}
Java
복사
codeup 짝수,홀수1번
import java.util.Scanner;
public class EvenOdd {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int num = scanner.nextInt();
if (num % 2 == 0) {
System.out.println("even");
} else {
System.out.println("odd");
}
}
}
Java
복사
codeup 짝수,홀수2번
문제
정수 두개가 입력으로 들어온다.
만약 첫번째 정수가 홀수이면 "홀수"를 출력하고,짝수이면 "짝수"를 출력한 후 "+"를 출력한다.
그리고 두번째 정수가 홀수이면 "홀수"를 출력하고, 짝수이면 "짝수"를 출력한 후 "="을 출력하고 결과로 나오는 값이 홀수인지 짝수인지 출력한다.
import java.util.Scanner;
class Evenodd {
Scanner scanner=new Scanner(System.in);
int firstname = scanner.nextInt();
int secondname = scanner.nextInt();
public String fitst(){
if (firstname%2==0) {
return "짝수";
}
return "홀수";
}
public String second(){
if (secondname%2==0) {
return "짝수";
} return "홀수";
}
public String last(){
if ((firstname+secondname)%2==0) {
return "짝수";
} return "홀수";
}
}
public class EvenOddTest {
public static void main(String[] args) {
Evenodd ev = new Evenodd();
System.out.println(ev.fitst()+"+"+ ev.second()+"="+ev.last());
}
}
Java
복사
임학준
최아영
SVN과 Git의 차이점
•
Git이 SVN과 다른 점은 분산형 관리 시스템이라는 것이다.
•
SVN은 중앙 서버에 소스코드와 히스토리를 저장한다.
•
Git은 소스코드를 여러 개발 PC와 저장소에 분산해서 저장한다.
Git 명령
git clone | 저장소 복제 |
git add | 변경 사항 추가 |
git commit | 커밋 생성 |
git push | 저장소에 올림 |
Source tree
•
Git을 그래픽화 시킨 Git GUI Repository로써 소스관리를 쉽게 도와주는 프로그램
배열 10칸
public class ArrayTest {
public static void main(String[] args){
int[] arr = new int[10];
for (int i=0; i<arr.length; i++) {
arr[i] = i;
}
System.out.print(Arrays.toString(arr));
}
}
Java
복사
화폐별 개수 출력
public class CurrencyCnt {
public static void main(String[] args) {
int c50000 = 50000;
int c10000 = 10000;
int c5000 = 5000;
int c1000 = 1000;
int c500 = 500;
int c100 = 100;
int c50 = 50;
int c10 = 10;
int refund = 25000;
System.out.printf("5만원권 %d장 나머지%d\n", refund / c50000, refund % c50000);
refund %= c50000;
System.out.printf("1만원권 %d장 나머지%d\n", refund / c10000, refund % c10000);
refund %= c10000;
System.out.printf("5천원권 %d장 나머지%d\n", refund / c5000, refund % c5000);
refund %= c5000;
System.out.printf("1천원권 %d장 나머지%d\n", refund / c1000, refund % c1000);
refund %= c1000;
System.out.printf("5백원권 %d장 나머지%d\n", refund / c500, refund % c500);
refund %= c500;
System.out.printf("1백원권 %d장 나머지%d\n", refund / c100, refund % c100);
refund %= c100;
System.out.printf("5십원권 %d장 나머지%d\n", refund / c50, refund % c50);
refund %= c50;
System.out.printf("1십원권 %d장 나머지%d\n", refund / c10, refund % c10);
refund %= c10;
}
}
Java
복사
홀수 짝수 구별
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
if (num % 2 == 0){
System.out.println("even");
} else {
System.out.println("odd");
}
}
}
Java
복사
홀수와 짝수 그리고 더하기
public class Main {
public static String getEvenOdd(int num) {
if (num % 2 == 0) {
return "짝수";
} else {
return "홀수";
}
}
public static void printEvenOddStatement(int first, int second) {
System.out.printf("%s+%s=%s", getEvenOdd(first), getEvenOdd(second), getEvenOdd(first+second));
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int first = sc.nextInt();
int second = sc.nextInt();
printEvenOddStatement(first, second);
}
Plain Text
복사
}
public class Main {
public static String getEvenOdd(int num) {
if (num % 2 == 0) {
return "짝수";
} else {
return "홀수";
}
}
public static void printEvenOddStatement(int first, int second) {
System.out.printf("%s+%s=%s", getEvenOdd(first), getEvenOdd(second), getEvenOdd(first+second));
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int first = sc.nextInt();
int second = sc.nextInt();
printEvenOddStatement(first, second);
}
}
Java
복사