Table of Contents |
---|
Overview
Remote Branch 현황
구분 | 용도 | 비고 | |
Remote | master또는main | TEST 및PROD 환경에 배포 가능한 상태로 관리되는 브랜치 | dev 브랜치로부터의 PullRequest를 통해서만 변경 가능 |
Remote | dev | 개발자가 로컬환경에서 구현한 기능을 반영하여DEV 환경에서 검증하기 위한 브랜치 | mater 브랜치의 코드 변경을위해 활용 |
Local | master | Remote master브랜치로부터 clone한 로컬의master브랜치 | 최초 소스 변경 작업 전Remote로부터 동기화 수행필요 |
Local | dev | 개발자가 로컬환경에서 기능을 구현하는용도로 사용되는 임시 브랜치 | 최초 소스 변경 작업 전Remote로부터 동기화 수행필요 |
main 브랜치 정책 적용
개발자 1 작업
소스 가져오기
git clone 및 디렉토리 이동
Code Block |
---|
youngdae.kim@youngdae_kim MINGW64 ~ $ git clone https://zerobig-devops4demo@dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 dev1 Cloning into 'dev1'... remote: Azure Repos remote: Found 6 objects to send. (18 ms) Unpacking objects: 100% (6/6), 980 bytes | 16.00 KiB/s, done. youngdae.kim@youngdae_kim MINGW64 ~ $ cd dev DevOps4OBBEES/ dev1/ dev2/ youngdae.kim@youngdae_kim MINGW64 ~ $ cd dev1 youngdae.kim@youngdae_kim MINGW64 ~/dev1 (main) $ ls -rlht total 5.0K -rw-r--r-- 1 youngdae.kim 1049089 985 Aug 10 15:23 README.md -rw-r--r-- 1 youngdae.kim 1049089 7 Aug 10 15:23 svc.txt |
...
Remote dev 브랜치 결과
Pull Request dev → main
개발자 2 작업 (푸시 전)
소스 가져오기
git clone 및 디렉토리 이동
Code Block |
---|
azure-demo# git clone https://zerobig-devops4demo@dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 dev2 Cloning into 'dev2'... Password for 'https://zerobig-devops4demo@dev.azure.com': remote: Azure Repos remote: Found 11 objects to send. (36 ms) Unpacking objects: 100% (11/11), 1.46 KiB | 5.00 KiB/s, done. azure-demo# cd dev2 azure-demo# ls -rlht total 4.0K -rwxrwxrwx 1 zerobig zerobig 985 Aug 10 2022 README.md -rwxrwxrwx 1 zerobig zerobig 25 Aug 10 2022 svc.txt -rwxrwxrwx 1 zerobig zerobig 0 Aug 10 2022 svc2.txt azure-demo# |
...
Code Block |
---|
azure-demo# git diff origin/main dev azure-demo# git add . azure-demo# git commit -m "Update svc.txt" [dev 77312ae] Update svc.txt 1 file changed, 2 insertions(+) azure-demo# git diff origin/main dev diff --git a/svc.txt b/svc.txt index 48dd634..66aa062 100644 --- a/svc.txt +++ b/svc.txt @@ -3,3 +3,5 @@ 3 4 dev1 5 dev1 +6 dev2^M +7 dev2^M |
커밋 전 로그
커밋 후 로그
개발자 1 작업 (개발자 2 푸시 전)
별도 파일
소스 변경 및 커밋 후 브랜치 비교
Code Block |
---|
youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git add . warning: LF will be replaced by CRLF in svc2.txt. The file will have its original line endings in your working directory youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git commit -m "Update svc2.txt" [dev aa128e8] Update svc2.txt 1 file changed, 2 insertions(+) |
...
dev → main Pull Request 수행
개발자 2 작업 푸시 후 재개
최신화 및 푸시하기
푸시 시행 전 리모트 변경사항 검토 실시 및 최신화 하여 푸시
...
Code Block |
---|
azure-demo# git push Password for 'https://zerobig-devops4demo@dev.azure.com': Enumerating objects: 9, done. Counting objects: 100% (8/8), done. Delta compression using up to 8 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (5/5), 643 bytes | 29.00 KiB/s, done. Total 5 (delta 1), reused 0 (delta 0) remote: Analyzing objects... (5/5) (25 ms) remote: Storing packfile... done (64 ms) remote: Storing index... done (50 ms) To https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 aa128e8..b3cb19d dev -> dev azure-demo# |
Pull Request 수행
개발자 1 작업
최신화 및 변경 작업 실시
최신화 및 작업 환경 준비
Code Block |
---|
youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git fetch origin dev --dry-run remote: Azure Repos remote: Found 5 objects to send. (0 ms) Unpacking objects: 100% (5/5), 623 bytes | 11.00 KiB/s, done. From https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 * branch dev -> FETCH_HEAD aa128e8..b3cb19d dev -> origin/dev youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git log --oneline aa128e8 (HEAD -> dev, origin/dev) Update svc2.txt f61e5b9 Update svc.txt, add svc2.txt 952c948 (origin/main, origin/HEAD, main) Added svc.txt 1d87295 Added README.md youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git pull origin dev From https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 * branch dev -> FETCH_HEAD aa128e8..b3cb19d dev -> origin/dev Updating aa128e8..b3cb19d Fast-forward svc.txt | 2 ++ 1 file changed, 2 insertions(+) |
...
Code Block |
---|
youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ vi svc.txt youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git add . youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git commit -m "Update svc.txt" [dev 9e1dacb] Update svc.txt 1 file changed, 2 insertions(+) youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ |
개발자 2 작업
최신화 및 변경 작업 실시
최신화 및 작업 환경 준비
Code Block |
---|
azure-demo# git fetch origin dev --dry-run Password for 'https://zerobig-devops4demo@dev.azure.com': From https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 * branch dev -> FETCH_HEAD azure-demo# |
...
Code Block |
---|
azure-demo# vi svc.txt azure-demo# azure-demo# git add . azure-demo# git commit -m "Update svc.txt" [dev c7d180f] Update svc.txt 1 file changed, 2 insertions(+) azure-demo# git fetch origin dev --dry-run Password for 'https://zerobig-devops4demo@dev.azure.com': From https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 * branch dev -> FETCH_HEAD azure-demo# azure-demo# git push Password for 'https://zerobig-devops4demo@dev.azure.com': Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 8 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 344 bytes | 18.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Analyzing objects... (3/3) (25 ms) remote: Storing packfile... done (62 ms) remote: Storing index... done (55 ms) To https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 b3cb19d..c7d180f dev -> dev azure-demo# |
리모트 커밋 저오
개발자 1 작업
최신화 및 변경 작업 실시
최신화 및 작업 환경 준비
Code Block |
---|
youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git fetch origin dev --dry-run From https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 * branch dev -> FETCH_HEAD b3cb19d..c7d180f dev -> origin/dev youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git pull origin dev From https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 * branch dev -> FETCH_HEAD b3cb19d..c7d180f dev -> origin/dev Auto-merging svc.txt CONFLICT (content): Merge conflict in svc.txt Automatic merge failed; fix conflicts and then commit the result. youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev|MERGING) $ |
...
Code Block |
---|
youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev|MERGING) $ git add svc.txt youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev|MERGING) $ git status On branch dev Your branch and 'origin/dev' have diverged, and have 1 and 1 different commits each, respectively. (use "git pull" to merge the remote branch into yours) All conflicts fixed but you are still merging. (use "git commit" to conclude merge) Changes to be committed: modified: svc.txt youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev|MERGING) $ git commit -m "Update svc.txt" [dev bccf33e] Update svc.txt youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git status On branch dev Your branch is ahead of 'origin/dev' by 2 commits. (use "git push" to publish your local commits) nothing to commit, working tree clean youngdae.kim@youngdae_kim MINGW64 ~/dev1 (dev) $ git push Enumerating objects: 10, done. Counting objects: 100% (10/10), done. Delta compression using up to 8 threads Compressing objects: 100% (6/6), done. Writing objects: 100% (6/6), 665 bytes | 83.00 KiB/s, done. Total 6 (delta 1), reused 0 (delta 0), pack-reused 0 remote: Analyzing objects... (6/6) (8 ms) remote: Storing packfile... done (56 ms) remote: Storing index... done (63 ms) To https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 c7d180f..bccf33e dev -> dev |
dev → main PR 수행
개발자 2 작업
최신화 및 작업 준비 실시
Code Block |
---|
azure-demo# git fetch origin dev --dry-run Password for 'https://zerobig-devops4demo@dev.azure.com': remote: Azure Repos remote: Found 6 objects to send. (0 ms) Unpacking objects: 100% (6/6), 645 bytes | 4.00 KiB/s, done. From https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 * branch dev -> FETCH_HEAD c7d180f..bccf33e dev -> origin/dev azure-demo# git pull origin dev Password for 'https://zerobig-devops4demo@dev.azure.com': fatal: Authentication failed for 'https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810/' azure-demo# git pull origin dev Password for 'https://zerobig-devops4demo@dev.azure.com': From https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 * branch dev -> FETCH_HEAD c7d180f..bccf33e dev -> origin/dev Updating c7d180f..bccf33e Fast-forward svc.txt | 2 ++ 1 file changed, 2 insertions(+) azure-demo# cat svc.txt 1 2 3 4 dev1 5 dev1 6 dev2 7 dev2 8 dev1 9 dev1 8 dev2 9 dev2 azure-demo# git log --oneline bccf33e (HEAD -> dev, origin/dev) Update svc.txt c7d180f Update svc.txt 9e1dacb Update svc.txt b3cb19d Merge branch 'dev' of https://dev.azure.com/zerobig-devops4demo/GiFlowDemo-20220810/_git/GiFlowDemo-20220810 into dev aa128e8 Update svc2.txt 77312ae Update svc.txt f61e5b9 Update svc.txt, add svc2.txt 952c948 Added svc.txt 1d87295 Added README.md azure-demo# |
...