merge requests 진행시 위와 같이
Merge blocked: merge conflicts must be resolved.
The source branch is n commits behind the target branch
경고가 뜨는 경우 아래 방법을 사용
https://stackoverflow.com/a/43015073
Before you begin, if you are uncomfortable with a command line, you can do all the following steps using SourceTree, GitExtensions, GitHub Desktop, or your favorite tool.
To solve the issue, you might have two scenarios:
1. Fix only remote repository branch which is behind commit
Example: Both branches are on the remote side
ahead === Master branch
behind === Develop branch
Solution:
- Clone the repository to the local workspace: this will give you the Master branch, which is ahead with commit
git clone repositoryUrl - Create a branch with Develop name and checkout to that branch locally
git checkout -b DevelopBranchName // this command creates and checkout the branch - Pull from the remote Develop branch. Conflict might occur. if so, fix the conflict and commit the changes.
git pull origin DevelopBranchName - Merge the local Develop branch with the remote Develop branch
git merge origin develop - Push the merged branch to the remote Develop branch
git push origin develop
2. Local Master branch is behind the remote Master branch
This means every locally created branch is behind.
Before preceding, you have to commit or stash all the changes you made on the branch behind commits.
Solution:
- Checkout your local Master branch
git checkout master - Pull from remote Master branch
git pull origin master
Now your local Master is in sync with the remote branch. As a result of the above command, other local branches branched from the previous local Master branch are not in sync. To fix that:
- Checkout the branch that is behind your local Master branch
git checkout BranchNameBehindCommit - Merge with the local Master branch
git merge master // Now your branch is in sync with the local Master branch
If this branch is on the remote repository, you have to push your changes.
git push origin branchBehindCommit
'눈가락' 카테고리의 다른 글
[리뷰] 페어페딕7 카키 한 달 사용 후기 (1) | 2023.01.07 |
---|---|
[AWS] IAM 공부 (0) | 2022.12.29 |
[IT] 빅데이터 필드 기술질문 대비 적어두는 것들 (0) | 2022.08.26 |
[IT] Orc vs Parquet 비교 (0) | 2022.08.10 |
[Pig Latin] 데이터 타입 확인 및 변경하는 방법 (0) | 2022.03.08 |