개발툴/GIT

Git 초기 설정

광고(주) 2025. 1. 18. 16:28
반응형

git
VCS(Version Control System) == SCM (Source Code Management)
< SCM(Software Configuration Management 형상관리시스템)
add 임시공간에 저장 staging area
commit 로컬에 저장 local repo
push 원격저장소에 저장 remote repo
git(툴) =/ github(웹서비스)
git —version 깃 버전

$ git config --list
$ git config --global autocrlf true(윈도우즈)
$ git config --global autocrlf intpu(맥)
$ git config --global user.name "당신의유저네임"
$ git config --global user.email "당신의메일주소"
$ git config --global —unset user.name 이름 삭제
$ git config --global core.editor "vim"
$ git config --global core.pager "cat"
$ git config --global --list

git status 깃 상태확인
git add README.md 스테이지에 저장
git commit 로컬 저장소에 저장
git push origin main
패스워드 토큰 생성
⇒github.com→setting→Developer settings→Personal access tokens→New personal access token

git log push 전 commit 상태 확인
git remote -v 원격저장소 확인

commit

docs: documentations
feat: features
conf: configurations
fix: bug-fix
refactor: refactoring
feat: features
docs: documentations
conf: configurations
test: test
fix: bug-fix
refactor: refactoring
ci: Continuous Integration
build: Build
perf: Performance

mkdir repo20220329 && cd repo20220329
git status
git init
rm -rf .git 깃init을 잘못해서 취소할때
git remote add mask https://github.com/keinetwork/repo20220329.git
git remote remove mask // 리모트 mask 이름삭제 다시 remote add 해야함
touch README.md
git add README.md
git commit -m “docs: Create README.md”
git branch -M main
git push -u mask main

mv 파일이름 변경 및 파일 이동

…or create a new repository on the command line

echo "# repo20220329" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/keinetwork/repo20220329.git
git push -u origin main

…or push an existing repository from the command line

git remote add origin https://github.com/keinetwork/repo20220329.git
git branch -M main

 

touch index.html
vi index.html
git status
git add index.html
git commit
git reset --hard HEAD~1 // git log에서 1나만큼 commit을 뒤로 되돌리기
git reset --hard ORIG_HEAD // 뒤돌린 버전을 복구하기
git push

git remote remove origin
git remote 
git remote add origin ~.git
git remote -v
반응형