Data/Information

git fork에 대한 짧은 조사 + 고찰

neulvo 2022. 11. 26. 21:59

github의 fork 기능을 cli에서 하고자 생각해봤다.

하지만 git bash cli에는 해당 명령어가 없는 것 같고 방법이라면 git remote add upstream으로 레포 연결하고 양쪽을 왔다갔다 할 수밖에 없는 듯 싶다... 이게 fork인가?



그래서 cli에서 하려면 github cli를 환경에 설치해줘야 하는데 그것은

 

GitHub - cli/cli: GitHub’s official command line tool

GitHub’s official command line tool. Contribute to cli/cli development by creating an account on GitHub.

github.com

에서 처럼 

MacOs는 brew install gh / Conda는 conda install gh --channel conda-forge 하면 되더라.



그 후에 해당 환경의 터미널에서 gh auth login 으로 github 연결하고

 

Fork a repo - GitHub Docs

About forks Most commonly, forks are used to either propose changes to someone else's project to which you do not have write access, or to use someone else's project as a starting point for your own idea. You can fork a repository to create a copy of the r

docs.github.com

여기 참고해서

원하는 방식으로 fork 해주면 됨

gh repo fork REPOSITORY 라는 명령어로 할 수 있음.

 

그런데 fork 완료 후, remote를 확인해 보니

이렇게 되어 있어서 위에서 말한 방법이 fork 맞는 건가? 싶었음.

git init하고 로컬 repo를 원격에 연결한 후, 다시 와서

remote add로 fork할 repo를 추가한 후 , git pull (fork repo) (local branch) 해주면 되는 것 같음.

위의 사진으로 예를 들면 git pull upstream main이 되겠네.

아마 다음에 한 번 시도해볼 것 같음.

728x90

'Data > Information' 카테고리의 다른 글

re - 정규식 연산  (0) 2022.04.22
정규표현식 python re  (0) 2022.04.22
Sql 문법 빠르게 훑어보기  (0) 2022.04.01
Hugging Face, Question answering  (0) 2022.04.01
Hugging Face, Training a causal language model from scratch  (0) 2022.04.01