DSTBX2023(6)

Author

SEOYEON CHOI

Published

January 12, 2024

실습68: 100MB 충돌

- 100MB가 넘는 파일을 upload할 경우 생기는 충돌 재현

git clone https://github.com/guebin/dinner.git # 각자 레포를 만들고 클론할것 
cd dinner # 클론한 repo로 이동
git config credential.helper store # git 등록 
wget https://media.githubusercontent.com/media/guebin/PP2023/main/posts/fashion-mnist_train.csv # 100MB넘는 csv다운로드 
git add .
git commit -m .
git push 
#여기서 1차당황

- 깃 클론 한 거 삭제후 다시 push

rm fashion-mnist_train.csv 
git add .
git commit -m .
git push 
# 여기서 2차당황

- 해결책? local에서 기존 폴더 잘 저장해놓고 깃폴더삭제하고 다시 clone

실습69: git ignore

- 다시 아래의 상황을 만듦.

git clone https://github.com/guebin/dinner.git # 각자 레포를 만들고 클론할것 
cd dinner # 클론한 repo로 이동
git config credential.helper store # git 등록 
wget https://media.githubusercontent.com/media/guebin/PP2023/main/posts/fashion-mnist_train.csv # 100MB넘는 csv다운로드 

- .gitignore 파일 생성

~/dinner/.gitignore
*.csv

위와 같이 입력

- 아래를 시도

git add .
git commit -m .
git push 

- 하위폴더도 영향받음을 확인

  • data라는 폴더를 생성
  • fashion-mnist_train.csv 를 data 폴더로 이동
  • ls data > ./data/data_list.txt 실행 (무슨뜻?)
  • github으로 push

실습70: 블로그 제목이 update 되지 않을때

Note

docs 로 render하는 버전일 떄, docs 폴더를 지우고 다시 render 하지

실습71: dinner를 codespace로 만들기

실습72: revert vs reset

git add .
git commit "message"
git log
git reset "log기록 넣기" --hard
Note

여기서 --hard는 중요하지 않음

그 시점으 자체로 돌아가는 것

git reflog
Note

시점이 적혀있는 git 기록들을 볼 수 있다.

HEAD@{0}: reset: moving to c7a5bf764427bde274f6d42472f13ac1b4fae152

이처럼 내가 reset한 기록도 뜬다,

Tip

시점 이동해서 파일 열어볼 수도 있지

특정 시점으로 이동 가능

마지막 git 이후에 git이 다시 log된다!

sudo apt-get install git으로 git을 설치함으로써 할 수 있는 action들이다.

실습73: 한꺼풀씩 revert

git log 가 3개 있다고 할때, 3시점으로 각각 위로 올라갈 수 있음.

Note

git add .

모든 파일을 올리겠다는 뜻

git add a.txt

a.txt 파일을 올리겠다는 뜻

실습74: revert, reset이 가능한 이유?

실습75: git과 github의 차이점

실습76: git branch

git branch "name"

이라고 치면 name의 branch 가 만드렁짐

실습77: mergerebase의 차이점

branch main으로 switch해서 하기

Note

git rebase "name"

하면 시점이 다시 작성됨, 원래 각 branch에 쓰이던 게 main이 한 것 처럼?

::: {.callout-tip} 만약 branch 간 같은 파일에 대해 각 branch에서 수정했다면 merge 하라고 경고 뜨고 rebase 해주지 않는다.:::

Note

git merge "name"

시점 순서 바뀌지 않음. main에 대한 시점이 추가될 뿐

실습78: 제가 쓰는 방식


git lens 를 vscode에서 쓰자

시각적으로 좋음