프로젝트 사용 구조
(팀장) github에 프로젝트 생성
1. master ( 조장 )이 github에서 프로젝트를 생성한다.
2. 팀원을 초대한다.
3. 팀원에게 권한을 부여한다
git branch 생성하기 ( dev 생성 )
git checkout -b dev
- dev : 브렌치이름
- checkout -b :
- git checkout master
- git merge brchB
- git push origin master
- 한것과 동일한 효과를 가짐! ( 생성하고 해당 branch에 merge를 잡고, 해당 branch로 이동까지 )
생성한 git brach인 dev로 기본 프로젝트 폴더 업로드하기
1. 업로드하고 싶은 기본 프로젝트 폴더에서 우클릭 > GIT Bash Here 클릭
2. 초기 설정해주기
git config --global user.name "유저 이름"
git config --global user.email "유저 이메일"
3. 파일 올리기
git init #상태확인(id,email확인)
git add .
git commit -m "주석"
git push origin dev #dev는 브렌치명
(팀원) dev에 있는 파일 받아오기
1. 파일을 받아올 위치에서 GIT Bash Here을 켜고 받아오기
git clone github주소
2. 받아온 파일안에 들어가서 GIT Bash Here 켜고
git log #현재 올라가있는 파일 확인
git branch #현재 컴퓨터에 생성되어있는 branch확인 = main만 있을 예정
git checkout -b dev origin/dev #dev 브랜치 생성 후 origin/dev로 설정
git branch #maiㅜ, dev가 뜨면 성공
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (main)
$ git log
commit d432ed60039ce8bca3956bb7f2f11d0f760a947c (HEAD -> main, origin/main, origin/dev, origin/HEAD)
Author: MrSeung <dlgustmd1231@naver.com>
Date: Thu Jul 6 11:10:19 2023 +0900
start
commit bb6255d98137b750247f1bab6eacae363a52928e
Author: MrSeung <128445175+MrSeung@users.noreply.github.com>
Date: Thu Jul 6 10:58:43 2023 +0900
Initial commit
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (main)
$ git branch
* main
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (main)
$ git checkout -b dev origin/dev
Switched to a new branch 'dev'
branch 'dev' set up to track 'origin/dev'.
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (dev)
$ git branch
* dev
main
3. 이어서 나의 branch 생성 ( 보통 branch의 이름은 해당하는 작업명 )
git checkout -b community
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (dev)
$ git checkout -b community
Switched to a new branch 'community'
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (community)
$ git branch
* community
dev
main
4. 원래 사용하던 파일에 코드를 다 짠뒤, 가져온(받아온) 파일에 옮겨넣고 올리기
( 내 브런치에 소스코드 업로드 )
git add .
git commit -m "first commit"
git push origin community
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (community)
$ git add .
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (community)
$ git commit -m "community test"
[community faad67b] community test
1 file changed, 1 insertion(+)
create mode 100644 teeeest.txt
EZENIC-174@DESKTOP-4EQ1GLL MINGW64 /d/_spring_workspace/bewithme_team/bewithme (community)
$ git push origin community
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 16 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 278 bytes | 278.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
remote:
remote: Create a pull request for 'community' on GitHub by visiting:
remote: https://github.com/MrSeung/bewithme/pull/new/community
remote:
To https://github.com/MrSeung/bewithme.git
* [new branch] community -> community
5. 내 branch에서 dev branch로 코드 업로드
'GIT > GIT' 카테고리의 다른 글
[git] git에 연결되어 있는 주소 변경하는 방법 (0) | 2023.09.12 |
---|---|
[git] 작업 완료시, 기능 구현한 파일을 dev branch에 병합하기 (0) | 2023.07.21 |
[git] git / github 기본사용 (올리기) (0) | 2023.03.26 |