Daily Develope

[Git] 기본 명령어 (init / commit / stash) 본문

Git

[Git] 기본 명령어 (init / commit / stash)

noggame 2022. 1. 7. 19:16

목차

- 신규 생성/등록

- Commit

- Stash (임시 저장)


신규 생성/등록

git init
git add {file}					# 업데이트할 파일 추가
git commit -m "{message}"			# 업데이트시 기록할 메시지 등록
git remote add {remote_name} {remote_url}	# remote_name으로 원격 저장소 주소 기록
git push -u {remote_name} {branch_name}		# remote_name의 branch_name 업데이트

 

Commit

ㅇ 전체 파일 일괄적으로 add 및 commit

git commit -a -m "{message}"

 

ㅇ Add된 파일 취소

git restore {file_name}

 

ㅇ Commit 취소

git reset HEAD {target_filename}

 

Stash

ㅇ 수정사항을 commit 하지 않고 임시 저장

git stash push -m "stash_name"

 

ㅇ 목록 확인

git stash list

 

ㅇ 불러 오기

# 최근 push된 stash 불러오기
git stash pop

# 특정 stash 불러오기
git stash apply stash@{0}

 

ㅇ 상세 보기

# 최근 stash 보기
git stash show

# 상세 보기
git stash show -p

# 특정 stash 정보 보기
git stash show stash@{0}

 

 

 

 

 

Comments