git(6)
-
[Git error] untracked working tree files would be overwritten
git error message : The following untracked working tree files would be overwritten by checkout git clean -fd --dry-run git clean -fd 옵션 -f: 파일 -d: 디렉토리 --dry-run : 어떤 파일이 지워지는지 미리 확인
2021.06.06 -
git add , git commit , git push "취소"
git add 취소(파일 상태 unstage로 변경) git reset HEAD [파일명] git commit 취소 - 너무 일찍 commit 했을 때 - 파일 빼먹고 commit했을 때 # commit을 취소하고 해당 파일들은 staged 상태로 워킹 디렉터리에 보존 $ git reset --soft HEAD^ # commit을 취소하고 해당 파일들은 unstaged 상태로 워킹 디렉터리에 보존 $ git reset --mixed HEAD^ // 기본 옵션 $ git reset HEAD^ // 위와 동일 $ git reset HEAD~2 // 마지막 2개의 commit을 취소 # commit을 취소하고 해당 파일들은 unstaged 상태로 워킹 디렉터리에서 삭제 $ git reset --hard HEA..
2021.04.26 -
git lfs
git에 대용량 파일을 추가하고 관리할 수 있도록 셋팅이 필요하다. 큰 이미지 파일이나 압축된 대용량의 파일이 있을 경우 git을 사용하는데 제한이 생긴다. git lfs로 용량 제한을 완화시킬 수 있다.(2GB) git-lfs rpm 파일을 다운로드 받아 설치하고 사용하면 된다. github.com/git-lfs/git-lfs/releases Releases · git-lfs/git-lfs Git extension for versioning large files. Contribute to git-lfs/git-lfs development by creating an account on GitHub. github.com curl -s https://packagecloud.io/install/reposito..
2021.04.10 -
git add/commit/push 취소
git add 취소 $ git reset HEAD 파일 상태를 Unstage로 변경 뒤에 파일명이 없으면 add한 파일 전체를 취소 git commit 취소 1. commit 취소 -> 해당 파일들 staged 상태로 working directory에 보존 $ git reset --soft HEAD^ 2. commit 취소 -> 해당 파일들 unstaged 상태로 working directory에 보존 $ git reset --mixed HEAD^ $ git reset HEAD^ $ git reset HEAD~2 마지막 2개의 commit을 취소 3. commit취소 -> 해당 파일들 unstaged 상태, working directory에서 삭제 $ git reset --hard HEAD^ git pu..
2021.04.10 -
branch 삭제 (local , remote) + 그 외 git branch 옵션들
local 브랜치 삭제 git branch -d 브랜치 명 remote 브랜치 삭제 git push origin --delete 브랜치명 역할 분담이 확실해지기 전 임시로 만들어서 작업했던 Joy라는 branch를 없애고 싶었다. 이러한 오류가 떴다. merge되지 않았기 때문에 중요한 파일을 잃을 것을 우려해 나오는 error로 보인다. error 메세지에 써져있는대로 -D 옵션을 통해 해결 되었다.(강제옵션) 이 외의 git branch 명령의 옵션들을 정리해보겠다 git branch [-l] -l 옵션은 생략가능 local branch 정보를 보여줌 git branch -v local branch의 정보를 마지막 commit 내역과 함께 보여줌 git branch -r remote의 branch 정..
2021.04.01 -
git error : the following untracked working tree files would be overwritten by checkout: 파일명
git에서 branch를 변경하려다 (git checkout 브랜치명) 이런 에러가 발생했습니다. $ git fetch --all $ git reset --hard origin/main 이 두가지 명령으로 해결했습니다. 1. git fetch 원격 저장소 내용을 가져와 local에 자동으로 병합 작업을 실행하는 git pull 명령과 달리, fetch는 원격 저장소의 내용을 확인만 하고, local data와의 병합은 실행하지 않습니다. fetch 실행 시 원격 저장소의 최신 이력을 확인하고, 최신 commit 이력은 이름 없는 branch로 local에 가져옵니다. (FETCH_HEAD라는 이름으로 checkout가능) 밑의 그림은 fetch시 local에 남는 이력에 대해 보여줍니다. B에서 진행된 ..
2021.03.24