기타

깃허브 제대로 배우기 (드림코딩 by 엘리)

 

 

# 깃, 깃허브 제대로 배우기 (기본 마스터편, 실무에서 꿀리지 말자)
https://www.youtube.com/watch?v=Z9dvM7qgN9s&t=3s

 

 


 

# git 설치

 

https://git-scm.com/

 


 

# Sourcetree 설치

 

https://www.sourcetreeapp.com/

 

– mecurial 체크 해제

 


 

# 기본 설정 (터미널 이용)

 

# 모든 설정 확인
git config –list

 

# 모든 설정 편집기로 열기
git config –global -e

 

# vscode 를 기본 편집기로 지정
git config –global core.editor “code”

 

# vscode를 기본 편집기로 지정하고 vscode 에서 설정 파일을 닫기 전까지 대기 (터미널 사용 불가)
git config –global core.editor “code –wait”

 

# git 사용자 정보 설정
git config –global user.name “username”
git config –global user.email “username@gmail.com”

 

# git 사용자 정보 표시
git config user.name
git config user.email

 

# 줄바꿈 문자 자동 변환 (윈도우에서는 기본 ‘\r\n’, git에 저장할 때는 ‘\n’ 으로 변환)
윈도우 : git config –global core.autocrlf true
맥 : git config –global core.autocrlf input

 

# 프로젝트 준비
projects 폴더 생성
projects/git 폴더 생성
projects/git 폴더에서 git init 명령어 입력 (깃 초기화: .git 폴더가 생성됨)

 

# 깃 프로젝트 삭제
rm -rf .git

 

# git 상태 보기
git status

 

# git 명령 단축어
git config –global alias.st status
git st

 

# git config 옵션 도움말
git config –h

 


 

GIT BASICS

 

# 3가지로 구성됨

working directory
— tracked
— untracked

staging area

.git directory

—————————————–

echo hello world! > a.txt

echo hello world! > b.txt

echo hello world! > c.txt

git status  // 상태 확인

 

# stagin area 로 옮기기
git add a.txt

git add b.txt c.txt

git add *.txt

 

echo friend >> a.txt

git status

 

# staging area 에서 내리기
git rm –cached *

 

rm a.txt

git add *

git add .

 

# git 과 github 에 파일 올리지 않기 (.gitignore 파일 이용) // tracking 하지 말라고 명령
echo *.log > .gitignore

 

# .gitignore
test.log
*.log
build/
build/.log

 

# git status 옵션 도움말
git status -h

git status -s  // 간략하게 상태 보기

 

# 파일 변경사항 비교
git diff
git diff –staged   (같은 명령 : git diff –cached)  // stage 에 올려져있는 파일 비교

# difftool 이용하기
git config –global -e  // 다음 4줄 추가

[diff]
    tool = vscode
[difftool “vscode”]
    cmd = code –wait –diff $LOCAL $REMOTE

 


git commit

git commit
# 로그 보기
git log
# 메시지와 함께 commit
git commit -m “second commit”
# working area 의 영역까지 함께 commit
git commit -am “second commit”

Related posts

Leave a Comment