오랜만에 git bash로 clone / push 하면서 했던 시행착오
clone
git clone "레포지토리명"
push
git add . git commit -m "mesg" git push origin main
blm운동으로 default branch가 master가 아닌 main으로 변경되었다.
참고) git deafult branch명 변경
위 내용을(branch명 확인하지 않음) 파악하지 못해 git log를 보고, reset해서 재시도했었다.
git status
git status
git log git log -oneline
git log는 전체 내용이 출력된다. commit history가 많은경우 가독성이 떨어짐. -oneline 옵션 사용
git reset
git reset --hard commit_id
git mv
VS mv
)
- git mv
git mv sunyong1 sunyong2
- mv
mv sunyong1 sunyong2 git add sunyong1 git rm sunyong2
git mv는 os상 mv를 사용하여 디렉토리명을 변경하는 것을 one-command로 제공하는 명령어이다.
push가 안되었던 원인은 다른이유였지만, git rm을 해주지 않고 git add. 후 push했었기에, 시행착오를 겪었을 것 같다. directiory rename의 경우 git rm까지 해주어야한다.
플러스 ) git mv는 대소문자를 구분하지 않는다. 그렇다면 sunyong -> Sunyong같이 변경하느 방법은 ? :
sunyong-> '다른이름' -> Sunyong으로 변경 시 대소문자 변경이 반영된다.