안녕하세요 늑대양입니다 :)
오늘은 어제에 이어서 git 2일차 특강이 진행됩니다!
오늘은 [AI 데이터 사이언티스트 취업 완성 과정]의 23일차 일과를 정리하여 안내해드리도록 하겠습니다.
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/001.gif)
Day 23 시간표:
- 오프라인 강의: git 특강
- 오프라인 강의: git 특강
Pre-practice(복습)
- repo: ghflow-practice
- branch: fb
- fizzbuzz.py > print("python works!")
- add, commit
- main에 merge 하기
- push
Pre-practice 2
- print 'fizz' if times of 3
- print 'buzz' if times of 5
# fizz branch 작업 완료 & main branch 작업 완료 후 merge 진행
git merge fizz
>
자동 병합: fizzbuzz.py
충돌 (내용): fizzbuzz.py에 병합 충돌
자동 병합이 실패했습니다. 충돌을 바로잡고 결과물을 커밋하십시오.
# fizzbuzz.py 확인
# 특수문자 (<<<< , ==== , >>>>) 는 나중에 지우도록하자..
# 노멀모드에서 dd > 잘라내기
# 노멀모드에서 p > 붙여넣기
vim fizzbuzz.py
for i in range(1, 15+1):
<<<<<<< HEAD
if i%5==0:
print("buzz")
=======
if i%3==0:
print("fizz")
>>>>>>> fizz
else:
print(i)
# 수정작업 진행
for i in range(1, 20+1):
if i%5==0:
print("buzz")
elif i%3==0:
print("fizz")
else:
print(i)
# 이후 작업
git status
git status
git add fizzbuzz.py
git status
git commit
>[main 64d73dc] Merge branch 'fizz'
gut push
Pre-practice 3
# conflict 해결 후, commit
Merge branch 'fizzbuzz'
# Conflicts:
# fizzbuzz.py
#
# It looks like you may be committing a merge.
# If this is not correct, please run
# git update-ref -d MERGE_HEAD
# and try again.
# 변경 사항에 대한 커밋 메시지를 입력하십시오. '#' 문자로 시작하는
# 줄은 무시되고, 메시지를 입력하지 않으면 커밋이 중지됩니다.
#
# 현재 브랜치 main
# 브랜치가 'origin/main'보다 3개 커밋만큼 앞에 있습니다.
# (로컬에 있는 커밋을 제출하려면 "git push"를 사용하십시오)
#
# 모든 충돌을 바로잡았지만 아직 병합하는 중입니다.
#
# 커밋할 변경 사항:
# 수정함: fizzbuzz.py
#
Branching models:
git flow:
- (hotfix)- master -(release)- develop - feature
- pros: 가장 많이 적용, 각 단계가 명확히 구분
- cons: 복잡..
- 어플리케이션 개발, 임베디드 개발 (정기적인 릴리즈 주기를 갖고 있는 워크로드)
github flow:
- master - feature
- pros: 브랜치 모델 단순화, master 의 모든 커밋은 deployable
- cons: CI 의존성 높음. 누구 하나라도 실수했다간..(pull request로 방지)
gitlab flow:
- production - pre-production - master - feature
- pros: deploy, issue에 대한 대응이 가능하도록 보완
- cons: git flow와 반대 ( master -develop, production -master)
fibonacci 구현 with github flow 실습:
![](https://blog.kakaocdn.net/dn/boAvF2/btrMTVX1ctd/2nrUiku75BZZjWgnaGmXc0/img.png)
- v1.0: recursion(점화식)
- v1.1: recursion with memoization(점화식 + 메모리)
- v2.0: binet's formula(공식)
꼭 해야 하는 것!
- 새로운 레포
- 동일한 파일에 대한 버전
cf) 파이썬 수학 표현식관련 URL: https://www.mathjax.org/
MathJax
Beautiful math in all browsers.
www.mathjax.org
피보나치 참고용 URL: http://www.milefoot.com/math/discrete/sequences/fibonacciseq.htm
Fibonacci Sequences
We use MathJax The Fibonacci Sequence Leonardo of Pisa, son of Bonaccio, studied mathematics at the beginning of the thirteenth century. He did much to bring Arabic mathematical notation and methods to the attention of Europe. He is most famous, though, fo
www.milefoot.com
Revert Everything!
Rename
Worst:
mv server.py main.py -> deleted, new file
Best:
git mv server.py main.py -> renamed
파일의 history를 남기기 위해서는 삭제 후 생성이 아닌 이름바꾸기로 추적
Undoing:
git checkout -- . or $ git checkout -- {filename}
Unstaging:
git reset HEAD {filename}
Unstaging and Remove:
git rm -f {filename}
Edit latest commit:
git commit --amend
Edit prior commit
git rebase -i <commit>
abort rebase
git rebase --abort
Complete rebase
git rebase --continue
Reset Commit
Worst case: Reset
ex) 직전 3개의 commit을 삭제한 후, remote에 강제 push
$ git reset --hard HEAD~3
$ git push -f origin <branch>
- 협업 시 다른 cloned repo에 존재하던 commit log로 인해 파일이 살아나거나, 과거 이력이 깔끔히 사라져 commit log tracking이 힘들어짐
- solution: 잘못한 이력도 commit으로 박제하고 수정한 이력을 남기자!!
Best case: Revert
ex) 현재 HEAD에서 직전의 3개의 commit을 순서대로 거슬러 올라가 해당 내역에 대해
commit, push 수행
git revert --no-commit HEAD~3..
git commit
git push origin <branch>
- 잘못하기 전 과거로 돌아가 최신을 유지하면서 되돌렸다는 이력을 commit으로 남겨 모 든 팀원이 이 사항을 공유하고 주지시킬 수 있음
- commit을 따로 안할땐 --no-edit
- merge commit을 되돌릴 땐 -m ( $git revert -m {1 or 2} {merge commit id} )
github issue and projects
Issue & Projects
- Issue: 프로젝트, 레포와 관계된 모든 해야할 일과 버그, 개선사항 등을 기록
- Projects: 해야할 일의 진도에 따른 구성과 우선순위 지정
Issue:
- Assignees: 이 이슈에 대한 책임인원
- Labels: 이슈의 종류
- Projects: 이슈를 배당할 프로젝트
- Milestone: 이슈에 해당하는 중요 시점 지정
Templates for issue(simple)
# .github/ISSUE_TEMPLATE.md
## Expected Behavior
## Actual Behavior
## Steps to Reproduce the Problem
1.
1.
1.
## Specifications
- Version:
- Platform:
- Subsystem:
Please ensure your pull request adheres to the following guidelines:
- [ ] Use the following format: `* [owner/repo](link)`
- [ ] Link additions should be added to the bottom of the relevant category.
- [ ] New categories or improvements to the existing categorization are welcome.
- [ ] Search previous suggestions before making a new one, as yours may be a duplicate.
- [ ] Sort by alphabetical order
<!-- Choose one of these types and delete else -->
fix #
resolve #
close #
## Proposed Changes
-
-
-
github flow with fork
- Create a new repository
- Clone and create sample file(fizzbuzz.py)
- Create a new issue
- Fork
- Set upstream(To pull recenct changes)
- Assignees & label select
- Work 🔥
- Open pull request
- Code review
- Submit review
- git add & commit
- git merge & push
- All commit goes to opened pull request(same branch)
- Approve and merge it
# Open a pull request
# 링크 연결 방법!
# 복수형 또는 과거형 사용 가능 (ex. close, closes, closed)
chose #1
reslove #1
fix #1
Final Practice
- 3~4인이 팀이 되어 프로젝트 수행
- 필수과제 Fizzbuzz와 아래의 과제 중 하나를 수행할 것(2 repositories)
- 피보나치킨 클론
- 100 prisoners problem
- Pig the dice game
- Monty Hall Problem Simulation
- Requirements
- 타겟 플랫폼, 언어나 Framework는 팀 내 협의 후 결정
- R&R 분배 -> 구현 -> 평가 순으로 진행
Final Practice 진행 결과 URL: https://github.com/sonhaechang/Pig-the-dice-game
GitHub - sonhaechang/Pig-the-dice-game
Contribute to sonhaechang/Pig-the-dice-game development by creating an account on GitHub.
github.com
![](https://t1.daumcdn.net/keditor/emoticon/friends1/large/014.gif)
긴 글 읽어주셔서 감사합니다 :)
'AI > [부트캠프] 데이터 사이언티스트 과정' 카테고리의 다른 글
[Megabyte School : AI 데이터 사이언티스트 취업 완성 과정] Day 25. (0) | 2022.09.27 |
---|---|
[Megabyte School : AI 데이터 사이언티스트 취업 완성 과정] Day 24. (2) | 2022.09.26 |
[Megabyte School : AI 데이터 사이언티스트 취업 완성 과정] Day 22. (2) | 2022.09.22 |
[Megabyte School : AI 데이터 사이언티스트 취업 완성 과정] Day 20. (0) | 2022.09.20 |
[Megabyte School : AI 데이터 사이언티스트 취업 완성 과정] Day 19. (0) | 2022.09.19 |