- A version control system helps keeping track of changes in software source code.
개정 이력 관리 시스템은 소프트웨어 소스코드의 어느 부분이 언제 어떻게 변경되었는지 추적하는 것을 도와줌. - With a version control system, trying and testing possibly risky attempts can be easier.
개정 이력 관리 시스템을 사용하면, 큰 혜택이 예상되나 위험성이 있는 시도의 부담을 줄여줌. - Currently in the late 2010s,
git
is one of the available version control softwares.
2010년대 말 현재, 여러 버전 관리 소프트웨어가 있으며 그 중 하나가git
. - Linus Torvalds created
git
in 2005 to maintain the source code of the Linux kernel.git
는 2005년 리누스 토발즈가 리눅스 커널의 소스코드를 관리하기 위해 개발. git
is an open source distributed version control system. A repository may have remote versions and local versions that are (practically) equivalent.git
는 그 원본 소스코드가 공개되어 있는 분산 버전 관리 시스템. 저장소를 원격 서버에 둘 수도 있고, 작업용 PC에 지역 저장소로 받을 수도 있음. 지역 저장소와 원격 저장소는 사실상 동일.
command 명령 |
expected behavior 예상 거동 |
example 예 |
---|---|---|
init |
initialize a git repository git 저장소 초기화 |
git init |
clone |
clone a git repository 원격 저장소로부터 지역저장소를 복제 |
git clone <repo url> git clone file://<path> |
log |
list the commit history 지금까지의 commit 목록 |
git log git log --help git log --stat git log --oneline --graph --all |
status |
current status of the working tree 작업 트리의 현재 상태 |
git status |
diff |
visualize changes after last commit and/or staging commit 또는 staging 이후 변경 사항 표시 |
git diff git diff HEAD git diff HEAD^ |
config |
list or adjust configuration 설정 표시 또는 변경 |
git config --list git config --global --unset credential.helper |
config user.name |
specify the user's name 사용자 이름 설정 |
git config user.name <your name> |
config user.email |
specify the user's email address 사용자 email 설정 |
git config user.email <your email> |
remote |
manage remote repository settings 원격 저장소 지정 설정 |
git remote add origin <remote repo> git remote -v |
add |
stage some changes to commit 변경 사항을 commit 하기 위해 준비 |
git add <path to a changed file> git add -p |
commit |
create an entry of change 변경 사항 등록 |
git commit git commit -m <message> |
push |
upload the changes to a remote repository 원격 저장소에 변경 사항을 반영 |
git push git push -u origin <branch name> |
checkout |
switch workspace to a certain commit 작업 공간을 특정 commit 당시로 되돌림 |
git checkout <commit hash> git checkout - git checkout -b <new branch> git checkout -- <file to undo> |
branch |
manage branches 분기 관리 |
git branch git branch -r git branch -a |
blame |
relates each line of code with commits 각 행 관련 commit 표시 |
git blame <file path> |
rebase |
move current branch on top of another branch 현 branch를 다른 branch 위로 옮김 |
git rebase <branch> git rebase -i <commit> |
merge |
merge another branch to the current branch 다른 branch를 현 branch 로 병합 |
git merge --no-ff <other branch> |
switch |
git 2.23 switch to another branch 다른 branch로 현 branch 로 변경 |
git switch <other branch> git switch -c <new branch name> git switch - git switch -guess <remote branch reference> |
restore |
git 2.23 roll back changes in a file to the index 파일의 변경 사항을 commit 또는 add 된 상태로 되돌림 |
git restore <edited file> git restore --source <commit> <file> |
--version |
Check git versiongit 버전을 확인 |
git --version |