본문 바로가기
CI&CD/Git

[Git] git commit하고 push 시 다른 팀원이 올렸을 경우

by TSpoons 2024. 8. 4.

열심히 작업 중 commit 하고, 점검 중에 있는데!! 누가 push 해버렸다!?

git push origin backup_branch 
To https://github.com/addinedu-ros-5th/ros-repo-5.git
 ! [rejected]        backup_branch -> backup_branch (fetch first)
error: failed to push some refs to 'https://github.com/addinedu-ros-5th/ros-repo-5.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

 

 

 

 

 

그럴 때는 rebase 옵션으로 가져오면 된다.

그러면 알아서 순서가 정렬되는데 내가 원하는 것은 아니다.

git pull --rebase origin backup_branch

 

git push origin backup_branch

 

 


분명히 내가 먼저 commit 올린 것 같은데!

push 순서로 기록되는 github commit 내역..