IT Study/개발 공부

Git 사용법 - 01

hyg4196 2021. 4. 15. 17:48
반응형

GitHub

 

Git 을 사용하는 이유 : 프로젝트를 진행하면서 여러 버전으로 관리가 가능하다.

 

Git 사용법 

- 준비물 :  Git 설치 , IDE , Sourcetree

 

Git 명령어

 

  1. git init (로컬 리포지터리 생성)
  2. git config user.name "hyg1488"
  3. git config user.email "hyg1488@gmail.com"
  4. .gitignore 파일 생성 후 내용 넣기
  5. git status 8개 확인
  6. git commit -m "첫 세팅" -> 작동 안함, 추가시켜 줘야 작동.
  7. git add .
  8. git status
  9. git commit -m "첫 세팅"
  10. git log  - (아래부터는 원격 리포지터리와 연동할때 사용 )
  11. git remote add origin 로컬 리포지터리와 원격 리포지터리와 연결 https://github.com/hyg1488/kotlin_text_board
    -> 오타 날경우 git remote remove origin 삭제후 다시 입력
  12. git push origin master -> 인증

 

Git 으로 여러 branch를 만들어 관리

 

merge 를 사용해 branch 의 변화를 가져와 적용

 

 

git branch [branch이름] : branch 생성

git add -A

git commit -m "설명" : 내용 저장

 

git merge [branch이름] : 해당 branch 를 현재 branch 에 변호 적용

 

git branch -D [branch이름] : 해당 branch 삭제

 

반응형