Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Exclude all files from pull request in a directory except specific directory


I'm trying to use the exclude files from diff feature to exclude specific files/directory in a directory, except one directory.

Say I have a directory A with sub directories B,C,D:

- A
    -- B
        -- foo.go
        -- bar.go
    -- C
        -- c.go
    -- D
        -- d.go

I want to match everything in A (also the files x.go, y.go), except C and it's content. In .gitignore I would do something like this:


But it doesn't seems to work as a bitbucket exclude pattern. Is there a workaround for this?


Thanks in advance,


1 answer

0 votes

Hi Avishay and welcome to the community.

I'm afraid that there is no way to negate a pattern in the Excluded files, this is also mentioned in the documentation you linked.

The workaround would be to match all files and directories that you want to be excluded. If the files x.go and y.go are in the A directory, you can exclude the following:


If the files x.go and y.go are in the root directory and not inside A, as follows:


Kind regards,

Hi Theodora,

The thing is that the content I want to exclude is generated content (this is usually the kind of content you want to exclude from diff).

Think about the following: you have directory A, and inside a directory C that contains code responsible for generating the rest of the code in A (dirs, files).
So you want to see the code in C in PR, but the reset of the code is generated so you want to exclude it from diff.

Writing the the dirs/files explicitly is not practical as it dynamically changes.

Please consider adding this as a feature request, this pretty common scenario.

Hi Avishay,

Thank you for the feedback and for explaining your use case.

I went ahead and created a feature request in our issue tracker:

I used your example to explain why this would be a useful feature.

Please make sure to add your vote to that feature request (by selecting the Vote for this issue link) as the number of votes helps the development team and product managers better understand the demand for new features.

You are more than welcome to leave any feedback, and you can also add yourself as a watcher (by selecting the Start watching this issue link) if you'd like to get notified via email on updates.

Implementation of new features is done as per our policy here and any updates will be posted in the feature request.

Kind regards,

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events