정답은 아닐 수 있으나 이 방법으로 수 많은 conflict를 해결해 왔습니다.
어디까지나 주니어의 입장이라 부족할 수는 있겠지만.. 한번...보시죠!
저는 push 전엔 습관적으로 진행하는 routine이 있는데요.
먼저, 제가 작업하던 브랜치를 feature/velog-notice-api 라고 하겠습니다.
git add .
git commit -m "Refactor: message"
git switch dev
git pull origin {dev} // dev는 생략 가능!
git switch feature/velog-notice-api
git rebase dev
Auto-merging app-core/src/main/java/com/...A.java
Auto-merging framework-jpa-querydsl/src/main/java/com/...B.java
Auto-merging framework-jpa-querydsl/src/main/java/com/...C.java
Auto-merging framework-jpa-querydsl/src/main/java/com/...D.java
CONFLICT (content): Merge conflict in framework-jpa-querydsl/src/main/java/...E.java
error: could not apply 커밋아이디... Refactor: message
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 커밋아이디... Refactor: message
To abort and get back to the state before "git rebase"로 돌아가고 싶습니다.git rebase --abort
git status
On branch feature/velog-notice-api
nothing to commit, working tree clean // 음! 다 commit된 상태로 잘 있네요 : )
git pull origin dev
Auto-merging app-core/src/main/java/com/...A.java
Auto-merging framework-jpa-querydsl/src/main/java/com/...B.java
Auto-merging framework-jpa-querydsl/src/main/java/com/...C.java
Auto-merging framework-jpa-querydsl/src/main/java/com/...D.java
CONFLICT (content): Merge conflict in framework-jpa-querydsl/src/main/java/...E.java
Automatic merge failed; fix conflicts and then commit the result.
git add .
git commit -m "Resolve: Conflict 해결"
git push origin feature/velog-notice-api
그리고 나면 코드가 내 작업 브랜치에 잘 push 된 걸 확인 할 수 수 있습니다! 모두 행복 git 하시길 바라며...🧚💫