Code Commit Branching Error

0

Hello, I hope someone can help, we keep going into AWS Commit Visualiser and there is a big black line going up through the middle (for which i think is the master branch), however we have two branches, branch a seems to generate a new line from the master branch of a different colour and goes back in like we expect, however branch b does not.

Here is the visualiser, it shows branch a working fine however its not showing it on branch b.
https://pasteboard.co/HXFoUro.png

Is it something we are doing? Here are our steps:

  • Change to Branch
  • Make Changes
  • Commit Changes
  • Push To Origin
  • Change To Master
  • Merge Branch we made the changes on into Master.
질문됨 5년 전372회 조회
3개 답변
0
수락된 답변

Hi,
Git does a fast forward merge by default whenever it is possible (https://git-scm.com/docs/git-config#git-config-mergeff). So when you merged the your first branch to master, since they shared the same parent commit, git did a fast forward merge. That's the reason you don't see the branching in the graph.
Now follow the same steps as you did except for a slight difference in step 3

  1. Commit and push to master branch
  2. Create a new branch and commit a file
  3. Change to master and merge using the following command
git merge --no-ff <branchname>

--no-ff means don't do a fast forward merge which will force to create a new merge commit.
And then follow the rest of the steps.

Please let me know if that resolved your question.

Thanks,
Aashwin

AWS
답변함 5년 전
profile picture
전문가
검토됨 16시간 전
0

Hi,
If I understood your use case correctly, you have a branch master that look say look like this
C2 -> C1 -> C0.
You create a branch off C1 (lets call this branch B1).
You create another branch from C1 (lets call this branch B2) and add a commit C4
Now you create a commit C3 to branch B1 and merge it into master (creating a merge commit C5). At this time you repo looks like this

          B2
           |
master    C4    
 |          \ 
C5 -> C2 -> C1 -> C0
     \      /
        C3 
        |
        B1

Now from the graph the history of master branch includes commits C5, C2, C3, C1, C0. Hence when you visualize the master branch in the commit visualizer you can see commits C3 (which is part of branch B1 and master since we merged it into master). However we don't see C4 since it's part of branch B2 and was never merged into master.

The black line in the commit visualizer is the color of the current branch that you have selected. So if you select master, commits C5 C2, C1 and C0 are part of the black line and commit C3 will be of a different color and will come back into master since we merged it.

I hope I understood your use case and this answers your question.

Thanks,
Aashwin

AWS
답변함 5년 전
0

I hope this explains better:
https://imgur.com/a/UubkgOe

답변함 5년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠