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

How to access the text in the diff view of sourcetree?

bendwarn May 23, 2016

Sometimes I want to patch the staged file with deleted texts. It would be convenient if I can select and copy them.

3 answers

1 accepted

2 votes
Answer accepted
QwazyWabbit
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2016

If I understand your question correctly, you want to copy-paste text from a staged file using the diff view of SourceTree into another file or from a file into the staged file.

To copy from the diff view, simply select the text in the view and do a ctrl-C / ⌘-C and ctrl-V / ⌘-V it anywhere.

The copy command is also available from a right-click context menu once you have selected the text in the diff view. 

As for modifying the staged file, you should probably be editing it in your primary editor. It will be updated and re-staged after you've saved the file in that editor and SourceTree senses the change.

bendwarn May 25, 2016

Thanks. The shortcuts works, though it only copies one entire line.

Because selecting in diff view is lame, it cannot choose just words or multiple lines.

Also, right-click context menu cannot appear in diff view.

Where can I issue a ticket for those function?

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2016

On Windows, you can select multiple lines, but selecting words or using right-click are not possible.

bendwarn May 26, 2016

Thanks, It's not dragging to select, but with shift. Now I see.

But it is kind of buggy. If you select a line and click the lines under it with shift, that works fine, But clicking upward is weird, which will unselect your previous selection and select next line.

Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2016

Yep. That's all you've got to work with in the built-in diff.

QwazyWabbit
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2016

I agree, it feels buggy and incomplete. It's not consistent between Windows and Mac platforms either, except for shortcut keys. FWIW, I typically use FileMerge on Mac and WinMerge on Windows for external diff tools. If I need a selective merge those are my tools of choice.

Right-click in diff view works on Mac but not on Windows. Clearly, a difference in behaviors between the platforms.

To report these issues, use Help | Report bug... in Windows; Help | Open a ticket on JIRA in Mac version. They're using their own tools to manage their bug list. 

In my experience Eric, i've yet to use the diff view in the manner you propose, I've always selected whole lines or blocks at a time for copy-paste and never tried spanning them or ctrl-select them. I'm either pulling whole commits or finding a change block to do a quick copy-paste from one project into another and never needed much else. It's not what the tool is about, IMHO. I'd still support your reporting it as a bug, especially the lack of context menu on Windows version. 

bendwarn May 26, 2016
0 votes
thinsoldier
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 26, 2016

What program do you have configured as your external diff tool?

I can select a file and press cmd+D to have the selected and previous versions open in my text editor side by side in diff mode.

For older versions I can right click the file and "open selected version" to open the file at the state it was in for that commit.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 23, 2016

You can use the git command line, or lunch the external diff tool from Sourcetree.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events