스태시 메시지 직접 입력 (Stash with message)
git stash save "[message...]"
스태시 리스트 보기 (Show stash list)
git stash list
특정 스태시 적용 (Apply stash)
git stash apply [index of stash list(0, 1, 2...)]
특정 스태시 삭제 (Remove stash)
git stash drop [index of stash list(0, 1, 2...)]
마지막 스태시 적용 후 삭제 (Apply last stash and remove)
git stash pop
추적되지 않는 변경사항까지 모두 스태시 (Stash with untracked files)
git stash --include-untracked
특정 브랜치로 이동 (Create new branch)
git checkout [branch_name]
브랜치가 없다면 생성 후 이동(Create new branch if doesn't exist and move)
git checkout -b [branch_name]
현재 변경사항 모두 초기화 (Reset all changes)
git checkout -- .
특정 파일만 초기화 (Reset specific file)
git checkout [file]
특정 커밋으로 이동 (Move to specific commit)
git checkout [commit]
특정 커밋의 바로 이전 커밋으로 이동 (Move to right previous of the specific commit)
git checkout [commit]^
특정 브랜치의 가장 마지막 커밋으로 이동 (Move to specific branch's last commit)
git checkout [branch_name]
브랜치 생성 (Create new branch)
git checkout -b [branch_name] << create and move to branch automatically
or
git branch [branch_name]
로컬 브랜치를 원격 저장소에 등록 (Add local branch to remote repository)
git push --set-upstream origin [branch_name]
로컬 브랜치 삭제 (Remove branch)
git branch -D [branch_name]
원격 브랜치 삭제 (Remove remote branch)
git branch -D [branch_name]
and then
git push origin --delete [branch_name]
or
git push origin :[branch_name]
로컬 브랜치 리스트 보기 (Show local branch list)
git branch --list
원격 브랜치 리스트 보기 (Show remote branch list)
git branch -r
브랜치 리스트 동기화 (Sync branch list between local and remote)
git fetch --all --prune
or
git remote prune origin
특정 디렉토리 분리
git filter-branch --subdirectory-filter {directory} -- --all
$ git filter-branch --index-filter \
'git rm --cached -qr --ignore-unmatch -- . &&
git reset -q $GIT_COMMIT --
locale/
README.md
scripts/event-geo.js
tests/build.smoketest.js'
--prune-empty -- --all
A 브랜치를 현재 브랜치로 머지 (Merge A branch to current branch)
git merge [A_branch_name]
A 브랜치를 현재 브랜치로 머지 {변경사항이 없어도 커밋을 생성} (Merge A branch to current branch with commit whether changes exist or not)
git merge --no-ff [A_branch_name]
특정 파일의 로그 확인 (삭제된 파일도 가능) (Show logs of specific file even if it removed)
git log -- [filename]
특정 파일이 포함된 가장 마지막 커밋 확인 (Show last commit that includes given file)
git rev-list -n 1 HEAD -- [filename]
파일이 삭제된 모든 커밋 로그 확인 (Show all commits that removed any files)
git log --diff-filter=D --summary