[Git] 명령어 모음
Git for Windows
Git for Windows focuses on offering a lightweight, native set of tools that bring the full feature set of the Git SCM to Windows while providing appropriate user interfaces for experienced Git users and novices alike. Git BASH Git for Windows provides a BA
gitforwindows.org
git 초기 설정
내가 원하는 위치에 폴더 생성 후 우클릭 - Git Bash Here
git init // 업로드할 폴더 지정 -> Initialized empty Git repository in 경로 출력되면 성공
git remote add origin https://github.com/(본인계정명)/(생성된 repository명).git
-> 별다른 문구 없으면 성공
git branch -M main // 브랜치명 main 으로 변경
git remote -v // 로컬 저장소 원격 저장소로 연결
Push 전엔 Pull이 있다! (명심)
git pull origin main// 폴더로 repository 자료 다 가져와
git status // 현재 Gut과의 상태 확인
git config --global core.autocrlf true // warning: LF will be replaced by CRLF in 에러시 변환 명령어
git add . // 변경된 파일들 모두 Tracking
git commit -m "message" // 변경사항 업로드 시 알려주는 commit 달아줌
git push origin main// 실제 Git에 Push
git checkout 브랜치명 // 브랜치 전환
Git Init Cancel
git init을 통해 만들어지게 된. git 폴더를 삭제합니다.
명령어 rm -r .git을 입력하면 .git 폴더가 삭제되며 Git 로컬 저장소 지정을 해제한다.
Git Clone
git clone https://github.com/(본인계정명)/(생성된 repository명).git
git fatch // 개인 작업 브랜치 생성 후 로컬에서 변경
git branch // 브랜치 확인
git checkout -b 브랜치명 // 브랜치 생성 후 이동
git push origin 생성한 브랜치명 // 원격(remote)에 브랜치 생성
git branch --set-upstream-to origin/생성한 브랜치명
git commendline 이쁘게?
git config --global alias.hist "log --graph --all --pretty=format:'%C(yellow)[%ad]%C(reset) %C(green)[%h]%C(reset) | %C(white)%s %C(bold red){{%an}}%C(reset) %C(blue)%d%C(reset)' --date=short"
ERROR
nothing to commit, working tree clean
git add를 했음에도 working tree에 아무것도 없을 때 기존 history가 사라져도 상관이 없다면
rm -rf .git
사용하여 .git 폴더 삭제!
초보 수준에서 사용하는 고육지책...?
Please tell me who you are .Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name" to set your account's default identity
해당 에러 메시지는
" 그래 이제 네가 설정해놓은 repository에 commit을 할 건데
그전에, 너는 누구야? "를 묻는 건데요,
에러 메시지에서 말해주는 대로
$ git config --global user.name "user name"
$ git config --global user.email "user e-mail"을 적어주면 됩니다
error: remote origin already exists // 이미 지정된 저장소가 있으므로
git remote remove origin // 기존 저장 폴더 해지 후 다시 지정
'개발 => 복습 후 재정리 대기 > Git' 카테고리의 다른 글
[Git] Pull Request 후 수정 (2) | 2021.12.18 |
---|---|
[Git] cherry-pick 하는 법 (2) | 2021.12.06 |
[Git] 토큰 인증 로그인 + 자격 증명 - remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. (29) | 2021.08.14 |
[GIT] .gitignore (0) | 2021.06.10 |
[Git] 꾸미기 (0) | 2021.05.18 |
댓글