깃을 좀 안쓰다보면 가끔 까먹는 내용이라, 미래의 나를 위해 정리해서 올려둬야겠다는 마음에 쓴 글이다. 간략하게 액기스만 적어뒀으니 도움이 되겠지?
git branch git branch -r #원격 git branch -a #모든 # Remote branch 상태 확인 / 유효하지 않은 원격 브랜치를 참조하는 경우 등을 확인할 수 있다. git remote show origin
# checkout의 디렉터리 전환 및 생성 기능이 switch 명령어로 대체됨. git switch [branch name] # 생성 git switch -c [branch name]
링크 : git 원격지 브랜치 삭제(delete remote branch)
git push origin --delete [branch name] # 혹은 아래와 같이 실행 git branch -d [branch name] git push origin [branch name]
한 번이라도 add한 적이 있는 파일(Modified or Tracked)은 전부 Stash 대상임.
# 커밋하기 애매한거 임시저장해서 워킹 디렉터리를 깨끗하기 비움. -u로 untracked도 저장 가능. git stash # 임시저장된 목록 확인 git stash -l # Stash된 내용을 워킹 디렉터리에 다시 적용 (파라미터 없으면 가장 최근 stash) git stash apply [stash@{num}] # Stash된 내용 삭제 git stash drop
# 가장 최근의 commit 취소 git reset HEAD^ # Reflog(브랜치와 HEAD가 지난 날동안 가리킨 커밋) 목록 확인 git reflog # 원하는 시점으로 워킹 디렉터리를 되돌림 git reset HEAD@{number} or git reset [commit id]
git commit -m "Return to current commit"
git push origin [branch name] -f git push origin +master
git checkout -- * # 혹은 아래처럼 삭제. -f: 파일, -d: 디렉터리, -x: 무시된 파일, -n: 실제론 안하고 시뮬레이션 결과 git clean -f -d -x
# develop은 name1, feature가 name2 git switch [branch name1] git rebase [branch name2]
git submodule update --init --recursive
[submodule "ffmpeg-ref"] path = ffmpeg-ref + url = git@bitbucket.org:n3n_us/md300-ref-ffmpeg.git
remote: error: cannot lock ref, exists; cannot create