git 명령어

I'm Your Cho-i·2022년 8월 1일
0

Github

목록 보기
1/2
post-thumbnail

📌git 연결

  1. 로컬 저장소의 git 히스토리 삭제
$ rm -rf .git
  1. git 초기화
$ git init
  1. 모든파일 git 추가 & 커밋
$ git add .
$ git commit -m "first project commit"
  1. 연결된 원격저장소 있는지 확인
$ git remote -v
  1. 이미 존재하는 원격저장소 삭제
$ git remote rm origin
  1. 저장소 연결 후 푸시
$ git remote add origin [url]
$ git push -u --force origin main

github master/main branch 이슈

GitHub 에서 2020년 10월을 기준으로 신규 레포지토리를 생성시 디폴트 브랜치 명이 main으로 생성됨.
https://github.blog/changelog/2020-10-01-the-default-branch-for-newly-created-repositories-is-now-main/

하나의 branch만 사용하고 싶으면
vscode에선 master가 기본 branch라 branch명을 변경후 push

$ git branch -M [되고싶은 branch name]
$ git branch -m [현재 branch name] [바꾸고싶은 branch name]
$ git pull origin [branch name]
$ git pull
$ git push -u origin main

[참고]
https://kkangsg.tistory.com/83
https://velog.io/@jinne808/git-%EB%82%B4%EA%B0%80-%EB%B3%B4%EB%A0%A4%EA%B3%A0-%EC%A0%95%EB%A6%AC%ED%95%98%EB%8A%94-git-%EB%AA%85%EB%A0%B9%EC%96%B4

profile
https://github.com/Cho-i

0개의 댓글