Git & Shell Script

limlim·2023년 4월 15일
0

GDSC YONSEI

목록 보기
1/3

git

git 공식문서를 참고하여 작성하였습니다.

git_add

git add [파일이름]: 해당 파일을 git이 관리(tracking)

git_commit

git commit -m "": git이 tracking하는 파일의 현재상태를 로컬 데이터베이스에 저장

git_push

git push [remote 이름][branch 이름]: 해당 branch의 상태를 remote(원격저장소)에 push하여 저장(반영)

remote

remote: 원격저장소

git_hook

어떤 이벤트가 생겼을 때 자동으로 특정 스크립트를 실행할 수 있도록 하는 명령어
client hook: commit / merge
server hook: push (서버에서 실행됨)

.git/hooks에 저장됨 (default)

pre_comment

commit할 때 가장 먼저 호출되는 hook, 커밋 작성 전 호출됨
커밋하는 snapshot(add를 통해 tracking한 파일들의 현 상태)을 점검
커밋할 때 꼭 확인해야할 것이 있으면 해당 명령어로 확인할 수 있음
if exit code != 0: 커밋 취소됨

pre_push

remote로 데이터를 전송하기 전에 호출됨
push 하기 전에 커밋이 유효한지 확인하는 용도로 사용할 수 있음

.git

commit, branch, information of files... 모두 해당 폴더에서 관리함

shell script

리눅스 매뉴얼 페이지를 참고하여 작성하였습니다. 해당 매뉴얼은 리눅스에서 man command로 확인할 수 있습니다.

ls

list dirctory contents

pwd

print name of current/working directory

cd

change the working directory
cd [이동하고자 하는 위치로의 상대, 절대 경로]

sudo

excute a command as another user

  • 해당 command를 사용하여 superuser privilege를 얻을 수 있음

vi

oriented (visual) display editor

  • screen-oriented text editor

vim

advenced text editor, vi보다 향상된 버전
참고: vim.org

bash

GNU Bourne-Again Shell
standard input이나 file에서 command를 읽고 실행하는 command language interpreter
bash [options][command_string | file]

zsh

scripting language and also shell designed for interactive use
bash보다 더 많은 기능을 지원함

chsh

change the user's login shell (current)

.bashrc

새 콘솔/터미널을 열때 실행, 로그인 없이 bash가 실행될 때 로드됨 (로그인에만 국한되는 것이 아님)

.zshrc

마찬가지로 새 콘솔을 열때 실행, 로그인 없이 zsh가 실행될 때 로드됨

source

bash 명령어인 .와 동의어 (. filename)
filename에서 command를 읽고 실행함
환경설정파일을 수정한 후에 수정된 값을 바로 적용하기 위해 사용 -> 특정 환경설정파일은 유저가 로그인할 때 읽는 파일이기 때문
ex) source /etc/bashrc

.profile

계정 디렉토리에 존재하는 파일.
bash 외의 shell로 로그인했을 때 로딩됨.
환경변수를 세팅할 때 사용

chmod

change file mode / permissions

chown

change file owner and group

ln

make links between files

  • create a link to TARGET with name Link_Name or current directory
profile
소개가 세상에서 제일 어려운 사람

0개의 댓글