Project : Git Branch Strategy : develop -feature/#3 - feature/#2 _ Push : Pull : Pull Request Compare and Base Branch

Byung Joo JeongByung Joo Jeong
3 min read

1. PR : base(develop) <- compare(feature/#3)

2. PR : base(feature/#3) <- compare(feature/#2)

In conclusion,

feature/#3 is merged into develop,

feature/#2 is merged into feature/#3

Develop branch -> feature/#3 branch (based on develop) -> feature/#2 branch (based on feature/#3)

I created feature/#2 branch based on feature/#3 branch, So, when I push feature/#2 , I created Pull-Request feature/#3(based) <- feature/#2(compared) .......... and then, I cloned develop branch from remote repository, I found feature/#3 branch successfully merged into develop, feature/#2 is successfully merged into feature/#3.

# If so what is your problem?

I found the feature of feature/#3 when I cloend develop branch.

But, At this point, I can't find out the feature of feature/#2. See image below.

Where to find "the feature of feature/#2."?

  • ah, Before we begin, the reason I did PR feature/#3(based) <- feature/#2(compared) instead of develop(based) <- feature/#2(compared) is that I want to leave exact file changes. Feature/#2 is based on Feature/#3, When I created PR to develop branch, The exact details of Its file changes aren't counted well.

1. Check your current branch:

> git branch

2.Create a new branch feature/#2:

> git checkout -b feature/#2

3.Pull changes from the remote feature/#2 branch:

> git pull origin feature/#2

Added that changes on feature/#2 branch.

4.Switch back to the develop branch:

> git checkout develop

5.Merge feature/#2 into develop: Ensure While I am on develop branch.

> git merge feature/#2

6.Resolve any conflicts if they occur during the merge.

Successfully Merged If you see a message like below.

scssCopy code8 files changed, 155 insertions(+)

It indicates that the merge was successful.

7.Once the merge is complete, push the changes to the remote develop branch:

> git push origin develop

To check it's successfully merged, hand-operated way

Like see above, we can't click Create pull Request

It's because, I pushed local develop branch into remote develop branch directly.

7.push the changes to the remote develop branch:

> git push origin develop

So, The only way to check is to clone? or to see file changes? No, I think we have 3 options.

1.Check the commit history: You can inspect the commit history on the remote repository to see if your merge commit is present. If it is, then your changes were successfully merged.

2. Review file changes : You can review the file changes either on the remote repository or by cloning the repository locally and checking out the develop branch to see if your changes are there.

3. Clone the repository : If you want to ensure everything is as expected, you can clone the repository to a new location and check the develop branch locally to verify that your changes are included.

: Below is Cloned file, I found it cloned successfully.

cf) This branch is 3 commits ahead of, 1 commit behine / This branch is 2 commits ahead of, 1 commit behind.

If feature/#2 is merged into feature/#3, and feature/#3 is already merged into develop, the scenario would look like this:

      Develop ──┬─────┬─────┬────────────────────────────────────────────
           \     \     \
feature/    └─────feature/#3
                  3 commits
                           \
                            └─ feature/#2
                            2 commits

Here, feature/#3 is merged into develop, and feature/#2 is merged into feature/#3.

So, if feature/#2 is already merged into feature/#3, and feature/#3 is merged into develop, you don't need to worry about merging feature/#2 directly into develop. All changes from feature/#2 are already included in develop via feature/#3.

0
Subscribe to my newsletter

Read articles from Byung Joo Jeong directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Byung Joo Jeong
Byung Joo Jeong