I created a new file based on a existed file in my repository. I committed the file but Stash marked as 'Copied' and not as 'Added'.
Why stash did that?
Git tracks file content, not files, so in your case Git detected that the new file was very much the same as the original file and recognized it as copied. This should not affect anything.
Is there any possibility to mark the file as created, to have better diffs?
No, it is all controlled by git.
Stash probably detected it because it might be using something similar to:
$ git diff -C ...
You'll usually see that you've copied from a similar file if you've modified the file you are "copying" from within the same commit. You can usually still see it as a new file if you run git diff locally.
For Bitbucket Server you can increase a setting causing only very similar files to be recognized as "copied" or "moved".
plugin.bitbucket-git.diff.renames.threshold
https://confluence.atlassian.com/bitbucketserver/bitbucket-server-config-properties-776640155.html/#BitbucketServerconfigproperties-plugin.bitbucket-git.diff.renames.threshold
There is a similar config for Stash:
plugin.stash-scm-git.diff.renames.threshold
https://confluence.atlassian.com/display/STASH026/Stash+config+properties
It looks like you're new here. Sign in or register to get started.