git help
git help tutorial
git help everyday
git help revisions
git help workflows
git help <command name>
git clone
새로운 directory로 Git repository(저장소)를 복제한다.
git init
기존에 존재하던 Git repository(저장소)를 다시 초기화하거나, 비어있는 Git repository(저장소)를 만든다.
git add <file name1> [<file name2> ...]
파일이나 폴더를 index에 추가한다.
git add .
현재 directory와 하위 directory에 위치한 모든 파일이나 폴더를 index에 추가한다.
Move or rename a file, a directory, or a symlink
Restore working tree files
Remove files from the working tree and from the index
git diff
변경했으나, index에 추가되지 않은 변화들을 출력한다.
git log
commit log를 출력한다.
git --graph
workflow(작업 흐름)을 시각화하여 출력한다.
git --oneline
commit messeage만 한 줄로 출력한다.
현재재 working tree의 상태를 출력한다.
Show various types of objects
git grep <pattern>
git에 있는 파일 내 문자열에서 pattern을 찾아 출력한다.
Use binary search to find the commit that introduced a bug
git branch
Git의 branch 목록을 출력한다. 이때 현재 working branch를 *로 강조한다.
git branch -m <old branch> <new branch>
branch 이름을 old brach에서 new branch로 변경한다.
git branch -M <old branch> <new branch>
branch 이름을 old brach에서 new branch로 강제로 변경한다.
git branch -d <branch name>
branch를 Local repository에서 삭제한다.
git branch -D <branch name>
branch를 Local repository에서 강제로 삭제한다.
git help branch
branch 관련 도움말을 출력한다.
repository에 변화를 기록한다.
Join two or more development histories together
Reapply commits on top of another base tip
Reset current HEAD to the specified state
기본 옵션값은 --mixed임.
git reset --mixed <commit hash>
되돌리기 전 데이터가 working directory에서 변경된 상태로 되돌린다. 즉 되돌리기 전 데이터가 추가된 상태이나, staging area에 올라가지 않은 상태이다.
git reset --hard <commit hash>
완전히 commit hash의 과거 상태로 되돌린다.
git reset --soft <commit hash>
되돌리기 전 데이터가 staging area에 add된 상태로 되돌린다.
git reset HEAD~<n 개 전 commit>
git reset HEAD<^> # ^의 갯수 당 1개 전으로 돌아감.
git switch <branch name>
woriking branch를 변경한다.
Git 2.23부터 checkout을 switch와 restore로 분할시켰다. 여전히 checkout을 사용할 수 있지만, 업데이트에 맞춰 switch와 restore을 사용하는게 바람직하다.
Create, list, delete or verify a tag object signed with GPG
Download objects and refs from another repository
Fetch from and integrate with another repository or a local branch
Update remote refs along with associated objects
git push origin --delete <branch name>
Remote repository에서 branch를 삭제한다.