기본 사용법


Git global setup

git config --global user.name "Seula Kang"
git config --global user.email "[email protected]"

Create a new repository

git clone <https://gitlab.com/vanillabrain/sellerking-web-frontend-clone.git>
cd sellerking-web-frontend-clone
git switch -c main
touch README.md
git add README.md
git commit -m "add README"
git push -u origin main

Push an existing folder

cd existing_folder
git init --initial-branch=main
git remote add origin <https://gitlab.com/vanillabrain/sellerking-web-frontend-clone.git>
git add .
git commit -m "Initial commit"
git push -u origin main

Push an existing Git repository

cd existing_repo
git remote rename origin old-origin
git remote add origin <https://gitlab.com/vanillabrain/sellerking-web-frontend-clone.git>
git push -u origin --all
git push -u origin --tags

취소하기


Git add, Git commit 취소하기

# git **add** 취소
git reset HEAD # 전체 취소
git reset HEAD <파일명> # 특정 파일 취소

# git **commit** 취소
git reset HEAD^ # 해당 파일 unstaged 상태로 보존
git reset --soft HEAD^ # 해당 파일 staged 상태로 보존
git reset --hard HEAD^ # 해당 파일은 unstaged 상태로 삭제

# commit message 변경
git commit --amend -m "변경 메시지"