개발 관련/Git & GitHub

    Git 명령어

    git status -s: 상태 간단하게 확인git diff: 변경/추가 된 내용 확인cat: 문서의 내용 확인 ex) cat c.txtgit config —global alias.st status: git status를 git st로 줄여서 사git commit -a: git add와 동시에 commitgit commit -am {MSG}: git add와 동시에 commit하며 메세지 입력git branch: 현재 branch 보기git branch {name}: branch 생성git checkout {name}: {name}의 브랜치로 들어간다.git log —branches: branch의 commit상태를 보여준다.git log —branches —graph: branch의 흐름을 보여줌git..

    [Git] ! [rejected] master -> master (non-fast-forward)

    ! [rejected] master -> master (non-fast-forward) PC1과 PC2에서 branch 테스트를 하는 도중 위와 같은 오류가 발생했다. PC2에서 class를 수정하여 push를 하고, PC1에서 pull 하지 않은채 push를 하려고 하니 충돌이 발생한듯 하다. git pull origin master --allow-unrelated-histories 위 명령어를 통해 강제로 merge시키는 방법이 있다고 하는데, 추천하지 않느다 하여 정석대로 commit을 취소한 후 pull 하여 최신 소스를 받은 후 다시 작업하여 push했다. 커밋 취소 방법 1. 명령어 git log 로 commit 확인 2. 명령어 git reset 0b5971 --hard 로 이전 상태로 되돌..