본문 바로가기
Git

git 설치 후 유용한 도구 소개

by jinsuc28 2022. 5. 6.

git 설치 후 유용한 도구 소개

 

1. git 설치

2. vim 과 cat

$ git config --global user.name "your git name"
$ git config --global user.email "your git email"
$ git config --global core.editor "vim" #git commit시 vim으로 commit message설정 가능
$ git config --global core.pager "cat" #git 파일 cat으로 읽음

$ git config --list # 정상으로 설정 되어있는 지 확인
$ vi ~/.gitconfig #수정 필요시 이용

vim cat을 설정해주어 commit할 때와 파일 확인 할 때 유용하게 쓰일 수 있다.

 

3. git log 명령어 쉽게 만들기

git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"


링크 주소: https://gist.github.com/johanmeiring/3002458

git log 확인하려면 긴 명령어 입력해야했지만 git log, git lg만으로 log 확인 가능

 

4. ipynb 파일 형상 관리 쉽게하는 도구

ipynb(jupyter notebook)json 기이기 문에 source control이

ex) {}{source}{print("name")} 이처럼 json 형식으로 print하나만 작성해도 길이가 장난 아님(뭐가 수정됬는지 확인 힘듬)

 

ReviewNB - Jupyter Notebook Code Reviews & Collaboration

Join 500+ companies like Amazon, Microsoft, Lyft, Deloitte, AirBnB in using ReviewNB to streamline your data science workflow. We enable Code Reviews & Collaboration for Jupyter Notebooks.

www.reviewnb.com

위 사이트는 github를 extension(연결)하여 gui형식으로 보여줌

 

GitHub - jupyter/nbconvert: Jupyter Notebook Conversion

Jupyter Notebook Conversion. Contribute to jupyter/nbconvert development by creating an account on GitHub.

github.com

위 사이트는 .py or .html 형식으로 변환해 줌

5. github repo 만드는 법 두가지

1.local repo 만들고 github에 올리는 방식

$ mkdir first-repo && cd first-repo
$ git init
$ git remote add origin https://github.com/{username}/{reponame}.git
$ touch README.md
$ git add README.md
$ git commit -m "docs: Create README.md"
$ git push -u origin master
2. github상 repo 만들고 주소를 clone하여 만듬

$ git clone {repo address}
$ git add .
$ git commit
$ git push

2번을 하게되면 폴더가 자동으로 생성 됨

1번을 나는 애용하는데 git repo명과 local명 변경 용의

5-1. vim commit을 쓰는 이유

git commit VS git commit -m "commit message" 

git commit
-vim 형식으로 commit 메세지 작성가능
-첫줄 제목, 두번째줄부터 부가 설명 (하지만,제목과 내용은 보기 좋게 한 줄 띄워 분리할 것.)
-가장 큰 장점 구체적인 commit 작성 가능

git commit -m "commit message"
-commit message 안에 모든 내용 작성 해야함
-오타 나올 시 처음부터 작성해야 함

 

 

 

※ git 업그레이드로 변경된 명령어

<branch 전환 명령어 변경>
git checkout [branch] #구버전 git
git switch [branch] #최신버전 git

 

※ .gitignore 파일 생성 방법

.gitignore git이 일을 추적할 , 더 등추적하지 도록 명시하기 위해 작성, 문서에 작성리스트는 수정발생해도 git이 시하다. 장자를 무시하거나 는 경우, 의 모 일을 무수 있습니다.

특히,, 암호 같은 것들 꼭꼭 숨겨 돈빠져나가지 않게 하자!!

밑에 주소들어가서 ignore할 파일들 설정하고 글 복사

touch .gitignore # gitignore는 숨김파일이여야 함 따라서 .gitignore로 생성
vi .gitignore #vim으로 파일 수정
복사 내용 붙여넣기 #복붙

아래와 같은 파일들을 무시해줌
# 주석을 달기 위한 Hashtag
# MacOS Setup
.DS_Store
# Python cache files
.py[cdo]
# Important files
/Important
# AWS key
key.pem

보통 mac os, jupternote, python, linux, aws, window를 gitignore로 생성함

https://www.toptal.com/developers/gitignore

 

gitignore.io

Create useful .gitignore files for your project

www.toptal.com

 

※ LICENSE

MIT License

- MIT에서 만스로, 동에 제, 자는 소프트에서 자유습니다.

(마음데로 써도 되고 상업적으로 사용 가능)

Apache License 2.0

- Apache 재단스로, 내용함되어 있습니다.

GNU General Public License v3.0

- 알려있으, 의무(스가 시 GPL 야 함)이 합니다.

(돈 내기 딱 좋은 license 꼭 코드를 공개해야하며 안할시 돈내야 함, 사업용으로는 naver..)

'Git' 카테고리의 다른 글

git Conventional Commits  (0) 2022.05.06
Git과 Github 개념  (0) 2022.05.06
shell 및 Vim command  (0) 2022.05.06
Mac에서 GitHub 사용법  (0) 2022.01.29