취보특개

Git Usage 본문

Gaebal

Git Usage

ha3kkkkk 2021. 2. 20. 12:51

Git 설치 (Windows 10)

 

 

1. 설치 파일 다운로드

  https://git-scm.com/

 

Git

 

git-scm.com

 

 

 

2. 설치파일 실행

[그림1] Git installer component

▶Additional icons - On the Desktop

▷ 바탕화면에 바로가기 추가

 

Widows Explorer integration - Git Bash Here 

Widows Explorer integration - Git GUI Here

폴더 우클릭으로 Git 바로 연결

 

Git LFS(Larage File Support)

용량이 큰 파일 지원

 

▶Associate .git* configuration file with default text editor

git 확장자 파일을 기본 텍스트 에디터와 연결

이후 설치파일의 'Choosing the default editor used by Git' 단계에서 에디터 선택

 

▶Associate .sh file to be run with Bash

sh 확장자 파일을 Bash와 연결

Use a TrueType font in all console windows

윈도우 콘솔창에서 TrueType 글꼴 사용

 

Check daily for Gir for windows updates

매일 Git 윈도우즈 업데이트 확인

 

 

 


 

git 설정

원하는 폴더에서 우클릭 > Git Bash Here 

[그림2] excute git bash
[그림3] display git config

$ git --version
$ git config --global user.name "name"
$ git config --global user.email "your@email.com"
$ git config --list

 


 

 

git 사용

 

github 또는 gitlab의 프로젝트 불러오기 (clone)

$ git clone [url]

 

 

프로젝트를 진행할 때는, branch(독립적인 공간)을 만들어 내 코드를 올린 후

master(branch의 root)에 merge request를 해야한다.

이 때 프로젝트 관리자들은 Compare 기능으로 master 코드와 다른부분을 살펴보고 merge를 승인해준다.

먼저 git에서 코드를 가져와 최신상태로 만든다.
$ git pull

브런치 리스트 출력
$ git branch --list

브런치 생성
$ git branch [branch_name]

생성한 브런치로 이동
$ git checkout [branch_name]

로컬과 원격을 비교하여 상태가 다른 파일 목록 확인 (upload해야하는 파일)
$ git status -s

파일 업로드
$ git add [파일경로 및 파일이름(status -s에서 나오는 그대로 치면 된다)]

파일 업로드를 다하고 난 후 commit을 한다. (메시지와 함께해야 예쁨 받는다)
$ git commit -m "[ADD] create test.cs file for BOT Search"


여기까지는 아직 원격에 반영이 안됐다.
아래 코드를 실행해주면 반영되고, git 웹페이지에서 확인가능하다.
$ git push --set-upstream origin [branch_name]

 

 

 

'Gaebal' 카테고리의 다른 글

오토핫키 사용법  (0) 2022.08.17
Comments