A commit is missing while viewing a specific branch from the Commits tab in the repository
Platform Notice: Cloud Only - This article only applies to Atlassian products on the cloud platform.
Summary
When viewing a specific branch from a repository Commits tab, some commits are missing. However, when viewing all branches (using the All branches filter), those missing commits are shown.
Example scenario:
You are looking for commit hash "V321D2" and when opening the Commits tab in the repository UI, the commit is shown. However, when you select Branch_B from the filter list, the commit "V321D2" is no longer present.
However, the commit exists locally and shows that it exists in both branches.
Diagnosis
Identify if the commit id "V321D2" exists in one or more branches
ℹ️ This command will show where the commit currently exists.
1 2 3
$ git branch --all --contains V321D2 Branch_A Branch_B
The output shows that commit "V321D2" exists in both Branch_A and Branch_B.
Use the git log command to review a branch commits history.
ℹ️ This command will show the current commit history on the specific branch
1 2 3 4
$ git log --oneline Branch_B 0e8185f4 (tag: Branch_B) Update CI c4a93202 Fix the crash 46b87b45 Update issue JIRA-123 to new version
The output shows that it's missing commit "V321D2" but all other commit is there.
Cause
According to the gitrevision documentation, the git log command prefers to use refs/tags/<ref> over refs/heads/<ref> based on its rules; hence the UI shows the commit "0e8185f4" because it is the current HEAD tag commit rather than the branch commit"V321D2".
Using the above example;
1
2
3
4
$ git log --oneline Branch_B
0e8185f4 (tag: Branch_B) Update CI
c4a93202 Fix the crash
46b87b45 Update issue JIRA-123 to new version
Bitbucket uses git log log --oneline Branch_B to display the commit list in the Commits repository UI. Since the current tags head is the commit "0e8185f4" it reflects the output in the Bitbucket Commits tab when selecting the specific branch hence commit "V321D2" is missing from the list.
Solution
The workaround is to delete the tag in the remote and local repositories or create another tag that doesn't share the same name as the current branch.
Use the command below to delete the duplicate name tag from the remote repository:
1
$ git push --delete origin <tagName>
Was this helpful?