$ git config --global user.name "USER-NAME"
$ git config --global user.email "USER-EMAIL"
$ git config --global color.ui auto
$ git config --list
$ ssh-keygen -t rsa -C "USER-EMAIL"
(패스워드 입력)
(.ssh폴더가 생성됨)
$ pbcopy < ~/.ssh/id_rsa.pub // 내용복사
(깃허브 설정페이지 New SSH Key 에 들어가서, 복사한 .ssh/id_rsa.pub 내용 붙여넣기)
$ ssh -T [email protected]
yes // 정상적으로 등록됨
ssh-keyscan github.com >> ~/.ssh/known_hosts
$ echo "# PROJECT-NAME" >> README.md
$ git init
$ git add README.md
$ git commit -m "first commit"
$ git branch -M main
$ git remote add origin [email protected]:kimniki/PROJECT-NAME.git
$ git push -u origin main
$ git add -u // deleted 적용
$ git commit -m "README파일 생성"
$ git commit --amend // 커밋메시지 변경
$ git commit -am "메시지" // add + commit
$ git push -u origin master // master브랜치의 수정내용을 업로드함
$ git push -u origin 브랜치명
$ git push origin 태그명
$ git reset HEAD // 이전 git add 취소
$ git reset --hard HEAD^ // 이전 git commit 취소
$ git push origin master --force
$ git reset --hard a5cfa34 돌아가려는주소
$ git push -f origin master
$ git rebase -i HEAD~2 // 최신순 커밋 2개 뭉치기
$ git reset --merge "0e51bf95e0c495490321d40bf43078a72eb60314" // 병합취소
$ git push origin master --force
$ git branch branch1 // branch1 브랜치 만들기
$ git checkout branch1 // branch1 브랜치로 이동하기
$ git checkout 브랜치명 // 브랜치이동
$ git checkout - // 이전 브랜치로 이동
$ git checkout -b 브랜치명 // 브랜치 만들고 이동
$ git checkout -b 브랜치명 origin/브랜치명 // 원격브랜치 기반 브랜치 작성
$ git push origin branch1 // branch1브랜치의 수정내용을 업로드함
$ git checkout master
$ git merge branch1
$ git merge --no-ff 브랜치명 // 현재브런치와 이 브런치 병합
(github에서 merge request & 승인)
$ git branch // 현재브랜치 보기
$ git branch -r // 현재저장소의 브랜치목록 보기
$ git branch -a // 원격 브랜치까지 보기
$ git branch -d (branch 이름)
$ git add FILE
$ git commit -m "MESSAGE"
$ git tag -a TAG-NAME -m "MESSAGE"
$ git push origin master && git push origin TAG-NAME
$ git tag 태그명 // 현재 태그로 만들기
$ git add *
$ git commit -m "register with passwd hash"
$ git tag -a v0.1-register -m "register with passwd hash"
$ git push origin master && git push origin v0.1-register
$ git log // 이력보기
$ git log 파일명
$ git log -p // 변경된 내용도 출력
$ git log --graph
$ git reflog // 현재브랜치뿐만 아니라 저장소전체 로그
$ git log
$ git show 4457926b690e892f7962bbc5a334bbdba038vgf // 커밋번호 $ git log 로 확인
$ git log --oneline --graph // 이력 그래프로 보기
$ git diff // add 안된 내용 확인
$ git diff HEAD // 변경내용 확인
(1) 기존 프로젝트에 gitignore 적용하기
$ git rm -r --cached .
$ git add .
$ git commit -m ".gitignore is now working"
$ git lfs install
$ cd ~/MY-FOLDER
$ git lfs track "*"
// 이 방법으로 업로드하면 깃허브에서 코드내용을 확인할 수 없음
// .gitattributes 추가
*.css linguist-detectable=false
- Issues / New issue 버튼 클릭
- 작성란에 이미지를 드래그해서 주소얻기
- 주소를 복사해서 README.md 파일에서 사용함