냥냠
[Git] Github 정리 - 1 본문
깃허브에 소스코드 올리고 커밋하는 방법, 내려받는 방법
1. 터미널에서 깃 명령어 사용
1) 소스코드를 깃에 올리는 방법
<terminal>
git init // 깃 초기화
git add . // 전부 선택
(git status // add할 파일 확인)
git commit -m "작업내용"
git remote add origin https://github.com/내 깃허브 이름/넣을 리포지터리.git
(git remote -v // 연결 확인)
git push origin master
2) commit 방법
<terminal>
git add .
(git status //확인)
git commit -m "작업내용"
git push origin master
3) 깃에 있는 소스코드 내려받기 ( 나 != master)
<terminal>
cd 다운받을 폴더 // cd project
git clone 깃허브 주소 파일이름 // git clone https://github.com/sueyeon00/jle_project.git jle_project
cd jle_project
code .
3-1) commit - 다른 브랜치
<terminal>
git add .
git commit -m "작업내용"
git checkout -b sueee // 새로운 브랜치 생성
git push origin sueee // master 말고 다른 브랜치에 커밋
이후
master)
pull requests에서 sueee가 커밋한 내용을 확인
'merge pull request' 버튼으로 합병
master 브랜치가 달라지면 모두 pull을 해줘야 함
<terminal>
git add .
git commit -m "작업한내용"
git pull origin master // push 하기 전에 pull 먼저!!
git push origin master
+++
다른 리포지토리에서 내 리포지토리로 옮길 때 ( 반대의 경우도 ) ex) 팀프로젝트 코드를 내 리포지토리에 옮기고 싶을 때
git clone --mirror {기존 레퍼지토리 주소}
cd {기존 레퍼지토리 명}.git. #이건 안해도 됨
git remote set-url --push origin {신규 레퍼지토리 주소}
git push --mirror
git 명령어 모음집
https://hackmd.io/@oW_dDxdsRoSpl0M64Tfg2g/ByfwpNJ-K
Git 명령어 총정리집 (by 코딩알려주는 누나❤) - HackMD
# Git 명령어 총정리집 (by 코딩알려주는 누나❤)  안녕하세요 여러분 :)
hackmd.io
2. 소스트리를 이용한 깃 사용법
1. 소스트리 설치
https://www.sourcetreeapp.com/
Sourcetree | Free Git GUI for Mac and Windows
A Git GUI that offers a visual representation of your repositories. Sourcetree is a free Git client for Windows and Mac.
www.sourcetreeapp.com
2. 내 깃허브와 연동하기
2-1. 리포지토리 가져오기
( 로컬(내 컴퓨터 저장소에 있는) , 원격(내 깃허브에 저장되어 있는) )
- 원격 저장소에서 가져오기(github)
clone https 주소 복사
소스트리에서 clone 버튼을 누르고
복사한 주소, 컴퓨터에 저장할 위치, 프로젝트 명 입력
이후 소스트리에 대한 과정은 다음 편에 !
'Git' 카테고리의 다른 글
[Git] Branch에 관한 내용 (1) | 2024.11.04 |
---|---|
[Git] push 문제 detached HEAD 해결 (0) | 2024.11.01 |
[Git] SourceTree 사용법 (commit, push) (0) | 2024.08.09 |
[Git] Git 브랜칭 전략 (0) | 2024.08.02 |