How to determine why there are fewer files in the diff view than the commit view - Bitbucket Server

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

目的

Within Bitbucket Server's GUI, a pull request's "Commits" view may list more files than what is seen in the "Diff" view. This is an analysis of how/why that may occur.

原因

This issue can occur when changes are cherry picked on source and/or target branch, rebasing or changes being merged from other branches.

The pull request diff shows the actual changes that would be applied to the target branch as a result of merging the source branch into it. This could mean that the changes for example.file already exist on master and the pull request would not actually make any changes to the file. This can be a result of cherry-picking, rebasing, or the changes being merged from other branches.

シナリオの例

  1. A file named b.rb is added committed and pushed to the master branch.
  2. A feature branch named feature/diff_tester is created.
  3. An exact copy of b.rb along with a new file, called a.rb is added, committed and pushed to the feature branch.
  4. A pull request is created to merge the feature (source) branch back into the master (target) branch.

As is shown in the image below, the "Commits" view in the pull request shows both a.rb and b.rb:

 

The "Diff" view, however, only shows the a.rb file:

This is because when the feature branch is merged into the master branch, the only difference will be the a.rb file as both master and feature branch contain the exact same b.rb file.
We can simulate what Bitbucket Server is displaying by doing the following in a local clone of the example repository with local branches for source-branch and master.

 

How to test from command line

In a working copy run the following and make note of the output – replace <source-branch> with the name of the source branch:

  1. git checkout master
  2. git merge <source-branch> --no-commit
  3. git status

 

 

The output will be similar to this:
[nhansberry:~/dev/diff_test] git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
[nhansberry:~/dev/diff_test] git merge feature/diff_tester --no-commit
Automatic merge went well; stopped before committing as requested
[nhansberry:~/dev/diff_test] git status
On branch master
Your branch is up-to-date with 'origin/master'.
All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)
 
Changes to be committed:
 
 new file:   a.rb

 



最終更新日: 2016 年 2 月 19 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.