git

git 형상관리

youngseokim_kr 2021. 10. 15. 16:27

git --version 

git version 2.31.1.windows.1

git init      //현재 프로젝트에서 변경사항 추적을 시작

Initialized empty Git repository in C:/Users/Owner/Desktop/test/starbucks/.git/

C:\Users\Owner\Desktop\test\starbucks>git config --global core.autocrlf true   //true값 입력  개행문자(new line) 설정 
//사용자 정보 등록  깃허브에 등록된 이름과 이메일을 매칭해서 등록 [커밋(버전 생성)을 위한 정보등록]
C:\Users\Owner\Desktop\test\starbucks>git config --global user.name 'youngseoKim-kr'   //이름 저장

C:\Users\Owner\Desktop\test\starbucks>git config --global user.email 'ysk5754@naver.com'  //이메일 저장

C:\Users\Owner\Desktop\test\starbucks>git config --global --list  //입력 정보 확인 [구성확인]
user.email='ysk5754@naver.com'
user.name='youngseoKim-kr'
core.autocrlf=true

 

C:\Users\Owner\Desktop\test\starbucks>git status  // 현재 버전 관리 상태

        css/
        favicon.ico
        favicon.png
        images/
        index.html
        js/

//git add index.html ->index.html을 변경사항 추적 중...[한개씩 버전관리에 등록]

C:\Users\Owner\Desktop\test\starbucks>git add .            //모든 파일의 변경사항을 추적하도록 지정 [전체]

C:\Users\Owner\Desktop\test\starbucks>git status

//결과

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   css/main.css
        new file:   favicon.ico
        new file:   favicon.png
        new file:   images/.DS_Store
        new file:   images/awards_slide1.jpg
        new file:   images/awards_slide10.jpg
        new file:   images/awards_slide2.jpg
        new file:   images/awards_slide3.jpg
        new file:   images/awards_slide4.jpg
        new file:   images/awards_slide5.jpg
        new file:   images/awards_slide6.jpg
        new file:   images/awards_slide7.jpg
        new file:   images/awards_slide8.jpg
        new file:   images/awards_slide9.jpg
        new file:   images/badge1.jpg
        new file:   images/badge2.jpg
        new file:   images/badge3.jpg
        new file:   images/empty.png
        new file:   images/favorite_bg.jpg
        new file:   images/favorite_text1.png
        new file:   images/favorite_text2.png
        new file:   images/find_store_bg.jpg
        new file:   images/find_store_picture1.jpg
        new file:   images/find_store_picture2.jpg
        new file:   images/find_store_text1.png
        new file:   images/find_store_text2.png
        new file:   images/find_store_texture1.png
        new file:   images/find_store_texture2.png
        new file:   images/floating1.png
        new file:   images/floating2.png
        new file:   images/floating3.png
        new file:   images/main_menu_new_icon.png
        new file:   images/main_menu_pattern.jpg
        new file:   images/promotion_slide1.jpg
        new file:   images/promotion_slide2.jpg
        new file:   images/promotion_slide3.jpg
        new file:   images/promotion_slide4.jpg
        new file:   images/promotion_slide5.jpg
        new file:   images/promotion_slide_pager.png
        new file:   images/promotion_slide_pager_on.png
        new file:   images/reserve_bg.jpg
        new file:   images/reserve_image.png
        new file:   images/reserve_logo.png
        new file:   images/reserve_store_bg.jpg
        new file:   images/reserve_store_medal_back.png
        new file:   images/reserve_store_medal_front.png
        new file:   images/reserve_text.png
        new file:   images/rewards.jpg
        new file:   images/season_product_bg.jpg
        new file:   images/season_product_image.png
        new file:   images/season_product_text1.png
        new file:   images/season_product_text2.png
        new file:   images/signin_bg.jpg
        new file:   images/starbucks_logo.png
        new file:   images/starbucks_logo_only_text.png
        new file:   images/starbucks_seo.jpg
        new file:   images/video_cover_pattern.png
        new file:   images/visual_bg.jpg
        new file:   images/visual_cup1.png
        new file:   images/visual_cup1_text.png
        new file:   images/visual_cup2.png
        new file:   images/visual_cup2_text.png
        new file:   images/visual_spoon.png
        new file:   images/visual_title.png
        new file:   index.html
        new file:   js/main.js
        new file:   js/youtube.js                          //버전 관리를 하겠다는 의미

// $ git commit -m '프로젝트 생성'   #메시지(-m)와 함께 버전을 생성

C:\Users\Owner\Desktop\test\starbucks>git commit -m "Start project"  // 새로운 버전 등록

C:\Users\Owner\Desktop\test\starbucks>git log  //새로운 버전 확인

commit fb7484d59357fd429b104d13be292cb23336e81f (HEAD -> master)
Author: youngseoKim-kr <ysk5754@naver.com>
Date:   Fri Oct 15 15:52:00 2021 +0900

    Start project          //결과

 

 

github에서 내 프로필을 누르고

your repositories 누르고 new    눌러서 파일 생성하고 주소를 복사해서 visual code로 가서

//원격의 저장소를 추가 하겠다 origin이라는 별칭으로 지칭하겠다.

//gitignore => node

C:\Users\Owner\Desktop\test\starbucks>git remote add origin https://github.com/youngseoKim-kr/starbucks.giㅅ

 

youngseoKim-kr/starbucks

Contribute to youngseoKim-kr/starbucks development by creating an account on GitHub.

github.com

주소를 등록해 주고

C:\Users\Owner\Desktop\test\starbucks>git push origin master  //origin이란 별칭의 원격 저장소로 버전 내역 전송

업로드 하면 github에 업로드 된다.

 

//수정하기 

C:\Users\Owner\Desktop\test\starbucks>git status  //상태를 보고

modified:   index.html   // 빨간색 수정된 부분이 나오면 

C:\Users\Owner\Desktop\test\starbucks>git add .   //추가해주기

C:\Users\Owner\Desktop\test\starbucks>git status  //현재 상태

modified:   index.html     // 초록색으로 변경

C:\Users\Owner\Desktop\test\starbucks>git commit -m "뱃지 이미지 수정" //수정한 것을 새로운 버전

C:\Users\Owner\Desktop\test\starbucks>git log   //여러 버전을 확인

C:\Users\Owner\Desktop\test\starbucks>git push origin master //다시 github 업로드

'git' 카테고리의 다른 글

git 버전 되돌리기  (0) 2021.10.17
새로운 환경에서 github 자료 복제하기  (0) 2021.10.17
브랜치 병합 (pull request)  (0) 2021.10.17
git branch  (0) 2021.10.15
netlify로 사이트 만들어보기  (0) 2021.10.15