Git 명령어 모음

단비·2023년 4월 25일
0

학습

목록 보기
16/66

🎃 설정 확인 방법

설정된 name, eamil 확인법

git config user.name
git config user.email

진행 히스토리 확인

git log

git 원격 저장소 확인 법 (보통은 origin)

git remote

로컬저장소에 설정한 레퍼지토리 주소 확인**

git remote -v

브랜치 확인

git branch

현재 저장소의 상태 확인

git status

commit 상태 확인

git log



🎃 환경설정

name, email 설정법

git config --global user.name "Danbi Kim"
git config --global user.email "dbkim@dbkim.com"

🤣 에러나서 변경 안될 때
$ git config --global --replace-all user.name "Kimdb"

브랜치 생성

git branch 브랜치명

브랜치 변경 (main으로 변경)

git config --global init.defaultBranch main
git checkout 브랜치명

브랜치 삭제

git branch -d 브랜치명

로컬저장소의 레퍼지토리 주소 변경

git remote set-url origin 변경될주소

로컬저장소에 설정한 레퍼지토리 주소 삭제

git remote rm origin



🎃 작업 환경설정

1. 새 저장소 만들기

git clone 레퍼지토리 주소
cd 폴더명
touch README.md

2. 기존 폴더 푸시

cd 폴더명
git init
git remote add origin 레퍼지토리 주소



🎃 Git 업로드 전처리

파일 stage에 올리기

  • .은 전체업로드, 이 외에는 파일명 기입
git add .
git add index.html

add 취소

  • 뒤에 파일명을 안쓸 경우 add한 파일 전체 취소
git reset HEAD 파일명
git reset HEAD

commit

git commit -m "코멘트"

commit 취소

git reset HEAD^



🎃 Git 업로드

push

git push -u origin 브랜치명
profile
tistory로 이전! https://sweet-rain-kim.tistory.com/

0개의 댓글