Using IntelliJ to diff two arbitrary files
I'm really liking the IntelliJ diff tool. I'm wondering if it is possible to use this tool to diff two arbitrary files. I.e. files NOT in an IntelliJ project. Just pick two files in the file system and diff them? What about if I want to diff two strings? In my text editor, I'd just create two new documents, paste the text in and diff them, then not save the files when done. Is this possible?
Thanks
intellij-idea diff
add a comment |
I'm really liking the IntelliJ diff tool. I'm wondering if it is possible to use this tool to diff two arbitrary files. I.e. files NOT in an IntelliJ project. Just pick two files in the file system and diff them? What about if I want to diff two strings? In my text editor, I'd just create two new documents, paste the text in and diff them, then not save the files when done. Is this possible?
Thanks
intellij-idea diff
You can: devnet.jetbrains.net/message/5299914#5299914 (search that forum for "diff command line" (or similar) for other similar threads)
– LazyOne
Jan 18 '13 at 12:13
add a comment |
I'm really liking the IntelliJ diff tool. I'm wondering if it is possible to use this tool to diff two arbitrary files. I.e. files NOT in an IntelliJ project. Just pick two files in the file system and diff them? What about if I want to diff two strings? In my text editor, I'd just create two new documents, paste the text in and diff them, then not save the files when done. Is this possible?
Thanks
intellij-idea diff
I'm really liking the IntelliJ diff tool. I'm wondering if it is possible to use this tool to diff two arbitrary files. I.e. files NOT in an IntelliJ project. Just pick two files in the file system and diff them? What about if I want to diff two strings? In my text editor, I'd just create two new documents, paste the text in and diff them, then not save the files when done. Is this possible?
Thanks
intellij-idea diff
intellij-idea diff
edited Nov 6 '17 at 18:53
Rumid
8032929
8032929
asked Jan 17 '13 at 19:20
Greg McGuffey
1,34831844
1,34831844
You can: devnet.jetbrains.net/message/5299914#5299914 (search that forum for "diff command line" (or similar) for other similar threads)
– LazyOne
Jan 18 '13 at 12:13
add a comment |
You can: devnet.jetbrains.net/message/5299914#5299914 (search that forum for "diff command line" (or similar) for other similar threads)
– LazyOne
Jan 18 '13 at 12:13
You can: devnet.jetbrains.net/message/5299914#5299914 (search that forum for "diff command line" (or similar) for other similar threads)
– LazyOne
Jan 18 '13 at 12:13
You can: devnet.jetbrains.net/message/5299914#5299914 (search that forum for "diff command line" (or similar) for other similar threads)
– LazyOne
Jan 18 '13 at 12:13
add a comment |
8 Answers
8
active
oldest
votes
Found this command line:
on MacOSX: (IDEA EAP 11)
/Applications/IntelliJ IDEA 11.app/Contents/MacOS/idea diff /Users/ben75/file1.txt /Users/ben75/file2.txt
On MacOSX it can't run when IDEA (11) is open.
on Windows: (IDEA EAP 12)
"C:Program Files (x86)JetBrainsIntelliJ IDEA 12.0binidea.exe" diff C:Usersben75file1.txt C:Usersben75file2.txt
It runs even if IDEA is already open.
I have trouble when trying to compare files with no extensions (or extensions that don't match )
Directly from IDEA (EAP 12)
Not so easy, but it works...
- File > Open... > select "file1.txt"
- File > Open... > select "file2.txt"
- Create a "Favorite list" and add both files to this favorite list.
(to do this : ctrl+right-click on file name tab in the editor > add
to favorite > select the favorite list just created - see screenshot) - Finally, open the "Favorites" view (Alt+2 or click on it on the left or your IDEA windows).
- Select both files
- Right click : "compare two files" (or ctrl+D)
19
Just CRTL + D on 2 files that are selected. No need struggling with favorites.
– ses
Oct 24 '13 at 20:09
9
The question is explicitly about two ARBITRARY files, not already in the project view. You can't select two files that do not exist in any view, thus you have to create favorites for them.
– Timo Türschmann
Mar 4 '16 at 11:25
I always struggled with this and started drag'n'drop these files into my project, just to compare them and delete them afterwards. Adding favorites is a nice workaround.
– Tim Büthe
Apr 7 '16 at 10:22
@TimoTürschmann.bashrc
<===alias idiff='"C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.2binidea64.exe" diff '
– John Smith
Nov 30 '17 at 1:12
I've added this function to my zsh configidiff() { "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea" diff "$(realpath $1)" "$(realpath $2)" }
, it allows to executeidiff
on relative paths too
– Poma
Jun 5 at 9:08
add a comment |
IntelliJ Idea 13 has a feature labeled Compare with Clipboard. This feature compares the current open file with a version that you have copied into your clipboard. It's a great, easy way to compare and merge two files easily. It can also be used to compare two arbitrary blocks of code. Can't figure out why one block works and another does not? Use this feature.
This option is present under View > Compare with Clipboard. I assigned an easy to remember keyboard shortcut to give me quick access to this feature.
Thanks for the info. I'll look into that!
– Greg McGuffey
Jan 24 '14 at 16:05
1
This is a really handy feature when migrating code from one Intellij project to another.
– Dan Torrey
Feb 6 '14 at 13:05
That's really cool, I looked for something like that under the Edit menu, and when I couldn't find it, assumed IntelliJ didn't have it! :)
– MHarris
Sep 5 '14 at 11:42
Do you know if it's possible to open up a blank diff window to allow comparisons of two different pieces of copy/pasted text? I do this all the time, but now working with Mac it seems all the diff tools want to work with files only. It's useful for grabbing bits of text out of documents to see what's changed, diffing just one function in a file, etc.
– Niall Connaughton
Oct 13 '16 at 22:37
add a comment |
Select 2 files in Project panel and press CTRL + D.
1
how do you select 2 files that aren't in the project ?
– ben75
Oct 24 '13 at 20:20
I put in there by drag and drop to the project, to some dedicated folder. Then just select them - by CTRL key on keyboard + right click by mouse on the table. (I use idea 12 just in case). Make sure you select 2 files but not 3 or 1. My point is - no need to use favorites.
– ses
Oct 24 '13 at 20:38
1
Ok but the question was about files that aren't in the project.
– ben75
Oct 24 '13 at 20:46
They are not to be in the project eventually (they are just temporary guests if you will). Otherwise: It might be costly for some guys like me to type paths in command line, pointing two files (especially if paths are long). Maybe you are right. This depends on point of view what is meaning 'not in the project'. I suppose they are guests to be compared, nothing wrong if I drop them there.
– ses
Oct 24 '13 at 20:55
add a comment |
Yes you can (of course, if we are talking about text
files). But probably you will need to create some project (just for opening there files).
Then your steps will be:
1) Add to created project file#1 and file#2.
2) Open file#1 in editor
3) Right click mouse in left menu (project files browser) on file#2 and find menu-item Compare File with Editor
.
That's all. After p.3) a comparison windows will be opened.
1
Thanks. I knew I could do the diff that way. I was attempting to figure out if I could skip going through a project and just do the diff. I suppose I could ask another question for a recommendation for a text editor that has a diff tool like intelliJ.
– Greg McGuffey
Jan 17 '13 at 22:10
add a comment |
In order to compare two files that both aren't in the project, the following works for me in IntelliJ IDEA Ultimate 14.1.7 on Windows:
- Open the first file in the IDE (either by dragging from Windows Explorer into the window, or by File / Open).
- In the view menu, choose "Compare With…"
- In the "Select Path" dialog that appears, select the second file (either directly, or by dragging from Windows Explorer into the dialog).
It then opens up in the traditional file comparison pane. If you try to edit one of the files, it presents the usual "Are you sure you want to edit a file that's not in your project" dialog, which one can accept if that's what one is trying to do.
This is actually a lot easier than creating projects are using favorites list!
– Ram
Mar 29 at 7:56
add a comment |
From the terminal, you can use the idea launcher directly like so:
# Windows
idea.exe diff path1 path2
# MacOS/Linux
idea diff path1 path2
At least for MacOS (I'm not certain of Windows), if you've created the Command-line Launcher via "Tools -> Create Command-line Launcher..." it's as simple as the following:
# Create some files to diff
echo "This is line 1" > file1.txt
echo "This is line 2" > file2.txt
# Diff with IntelliJ
idea diff file1.txt file2.txt
Note this works with other JetBrains applications as well; for example, using WebStorm or PyCharm:
# Diff with WebStorm
webstorm diff file1.txt file2.txt
# Diff with PyCharm
charm diff file1.txt file2.txt
Reference
add a comment |
In IntelliJ IDEA 2018.2, you can open an empty Differences Viewer and paste any text you want to compare in its left and right panels. The new Open Blank Diff Viewer action can be found in the Find Action dialog.
add a comment |
Since 2018.2, IntelliJ has officially supported it:
For windows: Ctrl + Shift + A, then type "Open Blank Diff Viewer"
For Mac: Cmd + Shift + A then type "Open Blank Diff Viewer"
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14386488%2fusing-intellij-to-diff-two-arbitrary-files%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
8 Answers
8
active
oldest
votes
8 Answers
8
active
oldest
votes
active
oldest
votes
active
oldest
votes
Found this command line:
on MacOSX: (IDEA EAP 11)
/Applications/IntelliJ IDEA 11.app/Contents/MacOS/idea diff /Users/ben75/file1.txt /Users/ben75/file2.txt
On MacOSX it can't run when IDEA (11) is open.
on Windows: (IDEA EAP 12)
"C:Program Files (x86)JetBrainsIntelliJ IDEA 12.0binidea.exe" diff C:Usersben75file1.txt C:Usersben75file2.txt
It runs even if IDEA is already open.
I have trouble when trying to compare files with no extensions (or extensions that don't match )
Directly from IDEA (EAP 12)
Not so easy, but it works...
- File > Open... > select "file1.txt"
- File > Open... > select "file2.txt"
- Create a "Favorite list" and add both files to this favorite list.
(to do this : ctrl+right-click on file name tab in the editor > add
to favorite > select the favorite list just created - see screenshot) - Finally, open the "Favorites" view (Alt+2 or click on it on the left or your IDEA windows).
- Select both files
- Right click : "compare two files" (or ctrl+D)
19
Just CRTL + D on 2 files that are selected. No need struggling with favorites.
– ses
Oct 24 '13 at 20:09
9
The question is explicitly about two ARBITRARY files, not already in the project view. You can't select two files that do not exist in any view, thus you have to create favorites for them.
– Timo Türschmann
Mar 4 '16 at 11:25
I always struggled with this and started drag'n'drop these files into my project, just to compare them and delete them afterwards. Adding favorites is a nice workaround.
– Tim Büthe
Apr 7 '16 at 10:22
@TimoTürschmann.bashrc
<===alias idiff='"C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.2binidea64.exe" diff '
– John Smith
Nov 30 '17 at 1:12
I've added this function to my zsh configidiff() { "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea" diff "$(realpath $1)" "$(realpath $2)" }
, it allows to executeidiff
on relative paths too
– Poma
Jun 5 at 9:08
add a comment |
Found this command line:
on MacOSX: (IDEA EAP 11)
/Applications/IntelliJ IDEA 11.app/Contents/MacOS/idea diff /Users/ben75/file1.txt /Users/ben75/file2.txt
On MacOSX it can't run when IDEA (11) is open.
on Windows: (IDEA EAP 12)
"C:Program Files (x86)JetBrainsIntelliJ IDEA 12.0binidea.exe" diff C:Usersben75file1.txt C:Usersben75file2.txt
It runs even if IDEA is already open.
I have trouble when trying to compare files with no extensions (or extensions that don't match )
Directly from IDEA (EAP 12)
Not so easy, but it works...
- File > Open... > select "file1.txt"
- File > Open... > select "file2.txt"
- Create a "Favorite list" and add both files to this favorite list.
(to do this : ctrl+right-click on file name tab in the editor > add
to favorite > select the favorite list just created - see screenshot) - Finally, open the "Favorites" view (Alt+2 or click on it on the left or your IDEA windows).
- Select both files
- Right click : "compare two files" (or ctrl+D)
19
Just CRTL + D on 2 files that are selected. No need struggling with favorites.
– ses
Oct 24 '13 at 20:09
9
The question is explicitly about two ARBITRARY files, not already in the project view. You can't select two files that do not exist in any view, thus you have to create favorites for them.
– Timo Türschmann
Mar 4 '16 at 11:25
I always struggled with this and started drag'n'drop these files into my project, just to compare them and delete them afterwards. Adding favorites is a nice workaround.
– Tim Büthe
Apr 7 '16 at 10:22
@TimoTürschmann.bashrc
<===alias idiff='"C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.2binidea64.exe" diff '
– John Smith
Nov 30 '17 at 1:12
I've added this function to my zsh configidiff() { "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea" diff "$(realpath $1)" "$(realpath $2)" }
, it allows to executeidiff
on relative paths too
– Poma
Jun 5 at 9:08
add a comment |
Found this command line:
on MacOSX: (IDEA EAP 11)
/Applications/IntelliJ IDEA 11.app/Contents/MacOS/idea diff /Users/ben75/file1.txt /Users/ben75/file2.txt
On MacOSX it can't run when IDEA (11) is open.
on Windows: (IDEA EAP 12)
"C:Program Files (x86)JetBrainsIntelliJ IDEA 12.0binidea.exe" diff C:Usersben75file1.txt C:Usersben75file2.txt
It runs even if IDEA is already open.
I have trouble when trying to compare files with no extensions (or extensions that don't match )
Directly from IDEA (EAP 12)
Not so easy, but it works...
- File > Open... > select "file1.txt"
- File > Open... > select "file2.txt"
- Create a "Favorite list" and add both files to this favorite list.
(to do this : ctrl+right-click on file name tab in the editor > add
to favorite > select the favorite list just created - see screenshot) - Finally, open the "Favorites" view (Alt+2 or click on it on the left or your IDEA windows).
- Select both files
- Right click : "compare two files" (or ctrl+D)
Found this command line:
on MacOSX: (IDEA EAP 11)
/Applications/IntelliJ IDEA 11.app/Contents/MacOS/idea diff /Users/ben75/file1.txt /Users/ben75/file2.txt
On MacOSX it can't run when IDEA (11) is open.
on Windows: (IDEA EAP 12)
"C:Program Files (x86)JetBrainsIntelliJ IDEA 12.0binidea.exe" diff C:Usersben75file1.txt C:Usersben75file2.txt
It runs even if IDEA is already open.
I have trouble when trying to compare files with no extensions (or extensions that don't match )
Directly from IDEA (EAP 12)
Not so easy, but it works...
- File > Open... > select "file1.txt"
- File > Open... > select "file2.txt"
- Create a "Favorite list" and add both files to this favorite list.
(to do this : ctrl+right-click on file name tab in the editor > add
to favorite > select the favorite list just created - see screenshot) - Finally, open the "Favorites" view (Alt+2 or click on it on the left or your IDEA windows).
- Select both files
- Right click : "compare two files" (or ctrl+D)
edited Jan 19 '13 at 10:58
answered Jan 19 '13 at 8:32
ben75
23.3k666114
23.3k666114
19
Just CRTL + D on 2 files that are selected. No need struggling with favorites.
– ses
Oct 24 '13 at 20:09
9
The question is explicitly about two ARBITRARY files, not already in the project view. You can't select two files that do not exist in any view, thus you have to create favorites for them.
– Timo Türschmann
Mar 4 '16 at 11:25
I always struggled with this and started drag'n'drop these files into my project, just to compare them and delete them afterwards. Adding favorites is a nice workaround.
– Tim Büthe
Apr 7 '16 at 10:22
@TimoTürschmann.bashrc
<===alias idiff='"C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.2binidea64.exe" diff '
– John Smith
Nov 30 '17 at 1:12
I've added this function to my zsh configidiff() { "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea" diff "$(realpath $1)" "$(realpath $2)" }
, it allows to executeidiff
on relative paths too
– Poma
Jun 5 at 9:08
add a comment |
19
Just CRTL + D on 2 files that are selected. No need struggling with favorites.
– ses
Oct 24 '13 at 20:09
9
The question is explicitly about two ARBITRARY files, not already in the project view. You can't select two files that do not exist in any view, thus you have to create favorites for them.
– Timo Türschmann
Mar 4 '16 at 11:25
I always struggled with this and started drag'n'drop these files into my project, just to compare them and delete them afterwards. Adding favorites is a nice workaround.
– Tim Büthe
Apr 7 '16 at 10:22
@TimoTürschmann.bashrc
<===alias idiff='"C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.2binidea64.exe" diff '
– John Smith
Nov 30 '17 at 1:12
I've added this function to my zsh configidiff() { "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea" diff "$(realpath $1)" "$(realpath $2)" }
, it allows to executeidiff
on relative paths too
– Poma
Jun 5 at 9:08
19
19
Just CRTL + D on 2 files that are selected. No need struggling with favorites.
– ses
Oct 24 '13 at 20:09
Just CRTL + D on 2 files that are selected. No need struggling with favorites.
– ses
Oct 24 '13 at 20:09
9
9
The question is explicitly about two ARBITRARY files, not already in the project view. You can't select two files that do not exist in any view, thus you have to create favorites for them.
– Timo Türschmann
Mar 4 '16 at 11:25
The question is explicitly about two ARBITRARY files, not already in the project view. You can't select two files that do not exist in any view, thus you have to create favorites for them.
– Timo Türschmann
Mar 4 '16 at 11:25
I always struggled with this and started drag'n'drop these files into my project, just to compare them and delete them afterwards. Adding favorites is a nice workaround.
– Tim Büthe
Apr 7 '16 at 10:22
I always struggled with this and started drag'n'drop these files into my project, just to compare them and delete them afterwards. Adding favorites is a nice workaround.
– Tim Büthe
Apr 7 '16 at 10:22
@TimoTürschmann
.bashrc
<=== alias idiff='"C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.2binidea64.exe" diff '
– John Smith
Nov 30 '17 at 1:12
@TimoTürschmann
.bashrc
<=== alias idiff='"C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2.2binidea64.exe" diff '
– John Smith
Nov 30 '17 at 1:12
I've added this function to my zsh config
idiff() { "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea" diff "$(realpath $1)" "$(realpath $2)" }
, it allows to execute idiff
on relative paths too– Poma
Jun 5 at 9:08
I've added this function to my zsh config
idiff() { "/Applications/IntelliJ IDEA.app/Contents/MacOS/idea" diff "$(realpath $1)" "$(realpath $2)" }
, it allows to execute idiff
on relative paths too– Poma
Jun 5 at 9:08
add a comment |
IntelliJ Idea 13 has a feature labeled Compare with Clipboard. This feature compares the current open file with a version that you have copied into your clipboard. It's a great, easy way to compare and merge two files easily. It can also be used to compare two arbitrary blocks of code. Can't figure out why one block works and another does not? Use this feature.
This option is present under View > Compare with Clipboard. I assigned an easy to remember keyboard shortcut to give me quick access to this feature.
Thanks for the info. I'll look into that!
– Greg McGuffey
Jan 24 '14 at 16:05
1
This is a really handy feature when migrating code from one Intellij project to another.
– Dan Torrey
Feb 6 '14 at 13:05
That's really cool, I looked for something like that under the Edit menu, and when I couldn't find it, assumed IntelliJ didn't have it! :)
– MHarris
Sep 5 '14 at 11:42
Do you know if it's possible to open up a blank diff window to allow comparisons of two different pieces of copy/pasted text? I do this all the time, but now working with Mac it seems all the diff tools want to work with files only. It's useful for grabbing bits of text out of documents to see what's changed, diffing just one function in a file, etc.
– Niall Connaughton
Oct 13 '16 at 22:37
add a comment |
IntelliJ Idea 13 has a feature labeled Compare with Clipboard. This feature compares the current open file with a version that you have copied into your clipboard. It's a great, easy way to compare and merge two files easily. It can also be used to compare two arbitrary blocks of code. Can't figure out why one block works and another does not? Use this feature.
This option is present under View > Compare with Clipboard. I assigned an easy to remember keyboard shortcut to give me quick access to this feature.
Thanks for the info. I'll look into that!
– Greg McGuffey
Jan 24 '14 at 16:05
1
This is a really handy feature when migrating code from one Intellij project to another.
– Dan Torrey
Feb 6 '14 at 13:05
That's really cool, I looked for something like that under the Edit menu, and when I couldn't find it, assumed IntelliJ didn't have it! :)
– MHarris
Sep 5 '14 at 11:42
Do you know if it's possible to open up a blank diff window to allow comparisons of two different pieces of copy/pasted text? I do this all the time, but now working with Mac it seems all the diff tools want to work with files only. It's useful for grabbing bits of text out of documents to see what's changed, diffing just one function in a file, etc.
– Niall Connaughton
Oct 13 '16 at 22:37
add a comment |
IntelliJ Idea 13 has a feature labeled Compare with Clipboard. This feature compares the current open file with a version that you have copied into your clipboard. It's a great, easy way to compare and merge two files easily. It can also be used to compare two arbitrary blocks of code. Can't figure out why one block works and another does not? Use this feature.
This option is present under View > Compare with Clipboard. I assigned an easy to remember keyboard shortcut to give me quick access to this feature.
IntelliJ Idea 13 has a feature labeled Compare with Clipboard. This feature compares the current open file with a version that you have copied into your clipboard. It's a great, easy way to compare and merge two files easily. It can also be used to compare two arbitrary blocks of code. Can't figure out why one block works and another does not? Use this feature.
This option is present under View > Compare with Clipboard. I assigned an easy to remember keyboard shortcut to give me quick access to this feature.
edited Sep 8 '14 at 18:28
answered Jan 21 '14 at 23:42
Dan Torrey
9161020
9161020
Thanks for the info. I'll look into that!
– Greg McGuffey
Jan 24 '14 at 16:05
1
This is a really handy feature when migrating code from one Intellij project to another.
– Dan Torrey
Feb 6 '14 at 13:05
That's really cool, I looked for something like that under the Edit menu, and when I couldn't find it, assumed IntelliJ didn't have it! :)
– MHarris
Sep 5 '14 at 11:42
Do you know if it's possible to open up a blank diff window to allow comparisons of two different pieces of copy/pasted text? I do this all the time, but now working with Mac it seems all the diff tools want to work with files only. It's useful for grabbing bits of text out of documents to see what's changed, diffing just one function in a file, etc.
– Niall Connaughton
Oct 13 '16 at 22:37
add a comment |
Thanks for the info. I'll look into that!
– Greg McGuffey
Jan 24 '14 at 16:05
1
This is a really handy feature when migrating code from one Intellij project to another.
– Dan Torrey
Feb 6 '14 at 13:05
That's really cool, I looked for something like that under the Edit menu, and when I couldn't find it, assumed IntelliJ didn't have it! :)
– MHarris
Sep 5 '14 at 11:42
Do you know if it's possible to open up a blank diff window to allow comparisons of two different pieces of copy/pasted text? I do this all the time, but now working with Mac it seems all the diff tools want to work with files only. It's useful for grabbing bits of text out of documents to see what's changed, diffing just one function in a file, etc.
– Niall Connaughton
Oct 13 '16 at 22:37
Thanks for the info. I'll look into that!
– Greg McGuffey
Jan 24 '14 at 16:05
Thanks for the info. I'll look into that!
– Greg McGuffey
Jan 24 '14 at 16:05
1
1
This is a really handy feature when migrating code from one Intellij project to another.
– Dan Torrey
Feb 6 '14 at 13:05
This is a really handy feature when migrating code from one Intellij project to another.
– Dan Torrey
Feb 6 '14 at 13:05
That's really cool, I looked for something like that under the Edit menu, and when I couldn't find it, assumed IntelliJ didn't have it! :)
– MHarris
Sep 5 '14 at 11:42
That's really cool, I looked for something like that under the Edit menu, and when I couldn't find it, assumed IntelliJ didn't have it! :)
– MHarris
Sep 5 '14 at 11:42
Do you know if it's possible to open up a blank diff window to allow comparisons of two different pieces of copy/pasted text? I do this all the time, but now working with Mac it seems all the diff tools want to work with files only. It's useful for grabbing bits of text out of documents to see what's changed, diffing just one function in a file, etc.
– Niall Connaughton
Oct 13 '16 at 22:37
Do you know if it's possible to open up a blank diff window to allow comparisons of two different pieces of copy/pasted text? I do this all the time, but now working with Mac it seems all the diff tools want to work with files only. It's useful for grabbing bits of text out of documents to see what's changed, diffing just one function in a file, etc.
– Niall Connaughton
Oct 13 '16 at 22:37
add a comment |
Select 2 files in Project panel and press CTRL + D.
1
how do you select 2 files that aren't in the project ?
– ben75
Oct 24 '13 at 20:20
I put in there by drag and drop to the project, to some dedicated folder. Then just select them - by CTRL key on keyboard + right click by mouse on the table. (I use idea 12 just in case). Make sure you select 2 files but not 3 or 1. My point is - no need to use favorites.
– ses
Oct 24 '13 at 20:38
1
Ok but the question was about files that aren't in the project.
– ben75
Oct 24 '13 at 20:46
They are not to be in the project eventually (they are just temporary guests if you will). Otherwise: It might be costly for some guys like me to type paths in command line, pointing two files (especially if paths are long). Maybe you are right. This depends on point of view what is meaning 'not in the project'. I suppose they are guests to be compared, nothing wrong if I drop them there.
– ses
Oct 24 '13 at 20:55
add a comment |
Select 2 files in Project panel and press CTRL + D.
1
how do you select 2 files that aren't in the project ?
– ben75
Oct 24 '13 at 20:20
I put in there by drag and drop to the project, to some dedicated folder. Then just select them - by CTRL key on keyboard + right click by mouse on the table. (I use idea 12 just in case). Make sure you select 2 files but not 3 or 1. My point is - no need to use favorites.
– ses
Oct 24 '13 at 20:38
1
Ok but the question was about files that aren't in the project.
– ben75
Oct 24 '13 at 20:46
They are not to be in the project eventually (they are just temporary guests if you will). Otherwise: It might be costly for some guys like me to type paths in command line, pointing two files (especially if paths are long). Maybe you are right. This depends on point of view what is meaning 'not in the project'. I suppose they are guests to be compared, nothing wrong if I drop them there.
– ses
Oct 24 '13 at 20:55
add a comment |
Select 2 files in Project panel and press CTRL + D.
Select 2 files in Project panel and press CTRL + D.
edited May 19 '16 at 4:30
Jossef Harush
15.1k45672
15.1k45672
answered Oct 24 '13 at 20:12
ses
6,6332092173
6,6332092173
1
how do you select 2 files that aren't in the project ?
– ben75
Oct 24 '13 at 20:20
I put in there by drag and drop to the project, to some dedicated folder. Then just select them - by CTRL key on keyboard + right click by mouse on the table. (I use idea 12 just in case). Make sure you select 2 files but not 3 or 1. My point is - no need to use favorites.
– ses
Oct 24 '13 at 20:38
1
Ok but the question was about files that aren't in the project.
– ben75
Oct 24 '13 at 20:46
They are not to be in the project eventually (they are just temporary guests if you will). Otherwise: It might be costly for some guys like me to type paths in command line, pointing two files (especially if paths are long). Maybe you are right. This depends on point of view what is meaning 'not in the project'. I suppose they are guests to be compared, nothing wrong if I drop them there.
– ses
Oct 24 '13 at 20:55
add a comment |
1
how do you select 2 files that aren't in the project ?
– ben75
Oct 24 '13 at 20:20
I put in there by drag and drop to the project, to some dedicated folder. Then just select them - by CTRL key on keyboard + right click by mouse on the table. (I use idea 12 just in case). Make sure you select 2 files but not 3 or 1. My point is - no need to use favorites.
– ses
Oct 24 '13 at 20:38
1
Ok but the question was about files that aren't in the project.
– ben75
Oct 24 '13 at 20:46
They are not to be in the project eventually (they are just temporary guests if you will). Otherwise: It might be costly for some guys like me to type paths in command line, pointing two files (especially if paths are long). Maybe you are right. This depends on point of view what is meaning 'not in the project'. I suppose they are guests to be compared, nothing wrong if I drop them there.
– ses
Oct 24 '13 at 20:55
1
1
how do you select 2 files that aren't in the project ?
– ben75
Oct 24 '13 at 20:20
how do you select 2 files that aren't in the project ?
– ben75
Oct 24 '13 at 20:20
I put in there by drag and drop to the project, to some dedicated folder. Then just select them - by CTRL key on keyboard + right click by mouse on the table. (I use idea 12 just in case). Make sure you select 2 files but not 3 or 1. My point is - no need to use favorites.
– ses
Oct 24 '13 at 20:38
I put in there by drag and drop to the project, to some dedicated folder. Then just select them - by CTRL key on keyboard + right click by mouse on the table. (I use idea 12 just in case). Make sure you select 2 files but not 3 or 1. My point is - no need to use favorites.
– ses
Oct 24 '13 at 20:38
1
1
Ok but the question was about files that aren't in the project.
– ben75
Oct 24 '13 at 20:46
Ok but the question was about files that aren't in the project.
– ben75
Oct 24 '13 at 20:46
They are not to be in the project eventually (they are just temporary guests if you will). Otherwise: It might be costly for some guys like me to type paths in command line, pointing two files (especially if paths are long). Maybe you are right. This depends on point of view what is meaning 'not in the project'. I suppose they are guests to be compared, nothing wrong if I drop them there.
– ses
Oct 24 '13 at 20:55
They are not to be in the project eventually (they are just temporary guests if you will). Otherwise: It might be costly for some guys like me to type paths in command line, pointing two files (especially if paths are long). Maybe you are right. This depends on point of view what is meaning 'not in the project'. I suppose they are guests to be compared, nothing wrong if I drop them there.
– ses
Oct 24 '13 at 20:55
add a comment |
Yes you can (of course, if we are talking about text
files). But probably you will need to create some project (just for opening there files).
Then your steps will be:
1) Add to created project file#1 and file#2.
2) Open file#1 in editor
3) Right click mouse in left menu (project files browser) on file#2 and find menu-item Compare File with Editor
.
That's all. After p.3) a comparison windows will be opened.
1
Thanks. I knew I could do the diff that way. I was attempting to figure out if I could skip going through a project and just do the diff. I suppose I could ask another question for a recommendation for a text editor that has a diff tool like intelliJ.
– Greg McGuffey
Jan 17 '13 at 22:10
add a comment |
Yes you can (of course, if we are talking about text
files). But probably you will need to create some project (just for opening there files).
Then your steps will be:
1) Add to created project file#1 and file#2.
2) Open file#1 in editor
3) Right click mouse in left menu (project files browser) on file#2 and find menu-item Compare File with Editor
.
That's all. After p.3) a comparison windows will be opened.
1
Thanks. I knew I could do the diff that way. I was attempting to figure out if I could skip going through a project and just do the diff. I suppose I could ask another question for a recommendation for a text editor that has a diff tool like intelliJ.
– Greg McGuffey
Jan 17 '13 at 22:10
add a comment |
Yes you can (of course, if we are talking about text
files). But probably you will need to create some project (just for opening there files).
Then your steps will be:
1) Add to created project file#1 and file#2.
2) Open file#1 in editor
3) Right click mouse in left menu (project files browser) on file#2 and find menu-item Compare File with Editor
.
That's all. After p.3) a comparison windows will be opened.
Yes you can (of course, if we are talking about text
files). But probably you will need to create some project (just for opening there files).
Then your steps will be:
1) Add to created project file#1 and file#2.
2) Open file#1 in editor
3) Right click mouse in left menu (project files browser) on file#2 and find menu-item Compare File with Editor
.
That's all. After p.3) a comparison windows will be opened.
answered Jan 17 '13 at 19:53
Andremoniy
21.7k673155
21.7k673155
1
Thanks. I knew I could do the diff that way. I was attempting to figure out if I could skip going through a project and just do the diff. I suppose I could ask another question for a recommendation for a text editor that has a diff tool like intelliJ.
– Greg McGuffey
Jan 17 '13 at 22:10
add a comment |
1
Thanks. I knew I could do the diff that way. I was attempting to figure out if I could skip going through a project and just do the diff. I suppose I could ask another question for a recommendation for a text editor that has a diff tool like intelliJ.
– Greg McGuffey
Jan 17 '13 at 22:10
1
1
Thanks. I knew I could do the diff that way. I was attempting to figure out if I could skip going through a project and just do the diff. I suppose I could ask another question for a recommendation for a text editor that has a diff tool like intelliJ.
– Greg McGuffey
Jan 17 '13 at 22:10
Thanks. I knew I could do the diff that way. I was attempting to figure out if I could skip going through a project and just do the diff. I suppose I could ask another question for a recommendation for a text editor that has a diff tool like intelliJ.
– Greg McGuffey
Jan 17 '13 at 22:10
add a comment |
In order to compare two files that both aren't in the project, the following works for me in IntelliJ IDEA Ultimate 14.1.7 on Windows:
- Open the first file in the IDE (either by dragging from Windows Explorer into the window, or by File / Open).
- In the view menu, choose "Compare With…"
- In the "Select Path" dialog that appears, select the second file (either directly, or by dragging from Windows Explorer into the dialog).
It then opens up in the traditional file comparison pane. If you try to edit one of the files, it presents the usual "Are you sure you want to edit a file that's not in your project" dialog, which one can accept if that's what one is trying to do.
This is actually a lot easier than creating projects are using favorites list!
– Ram
Mar 29 at 7:56
add a comment |
In order to compare two files that both aren't in the project, the following works for me in IntelliJ IDEA Ultimate 14.1.7 on Windows:
- Open the first file in the IDE (either by dragging from Windows Explorer into the window, or by File / Open).
- In the view menu, choose "Compare With…"
- In the "Select Path" dialog that appears, select the second file (either directly, or by dragging from Windows Explorer into the dialog).
It then opens up in the traditional file comparison pane. If you try to edit one of the files, it presents the usual "Are you sure you want to edit a file that's not in your project" dialog, which one can accept if that's what one is trying to do.
This is actually a lot easier than creating projects are using favorites list!
– Ram
Mar 29 at 7:56
add a comment |
In order to compare two files that both aren't in the project, the following works for me in IntelliJ IDEA Ultimate 14.1.7 on Windows:
- Open the first file in the IDE (either by dragging from Windows Explorer into the window, or by File / Open).
- In the view menu, choose "Compare With…"
- In the "Select Path" dialog that appears, select the second file (either directly, or by dragging from Windows Explorer into the dialog).
It then opens up in the traditional file comparison pane. If you try to edit one of the files, it presents the usual "Are you sure you want to edit a file that's not in your project" dialog, which one can accept if that's what one is trying to do.
In order to compare two files that both aren't in the project, the following works for me in IntelliJ IDEA Ultimate 14.1.7 on Windows:
- Open the first file in the IDE (either by dragging from Windows Explorer into the window, or by File / Open).
- In the view menu, choose "Compare With…"
- In the "Select Path" dialog that appears, select the second file (either directly, or by dragging from Windows Explorer into the dialog).
It then opens up in the traditional file comparison pane. If you try to edit one of the files, it presents the usual "Are you sure you want to edit a file that's not in your project" dialog, which one can accept if that's what one is trying to do.
answered Nov 6 '17 at 17:12
Peter Cooper Jr.
6,49432742
6,49432742
This is actually a lot easier than creating projects are using favorites list!
– Ram
Mar 29 at 7:56
add a comment |
This is actually a lot easier than creating projects are using favorites list!
– Ram
Mar 29 at 7:56
This is actually a lot easier than creating projects are using favorites list!
– Ram
Mar 29 at 7:56
This is actually a lot easier than creating projects are using favorites list!
– Ram
Mar 29 at 7:56
add a comment |
From the terminal, you can use the idea launcher directly like so:
# Windows
idea.exe diff path1 path2
# MacOS/Linux
idea diff path1 path2
At least for MacOS (I'm not certain of Windows), if you've created the Command-line Launcher via "Tools -> Create Command-line Launcher..." it's as simple as the following:
# Create some files to diff
echo "This is line 1" > file1.txt
echo "This is line 2" > file2.txt
# Diff with IntelliJ
idea diff file1.txt file2.txt
Note this works with other JetBrains applications as well; for example, using WebStorm or PyCharm:
# Diff with WebStorm
webstorm diff file1.txt file2.txt
# Diff with PyCharm
charm diff file1.txt file2.txt
Reference
add a comment |
From the terminal, you can use the idea launcher directly like so:
# Windows
idea.exe diff path1 path2
# MacOS/Linux
idea diff path1 path2
At least for MacOS (I'm not certain of Windows), if you've created the Command-line Launcher via "Tools -> Create Command-line Launcher..." it's as simple as the following:
# Create some files to diff
echo "This is line 1" > file1.txt
echo "This is line 2" > file2.txt
# Diff with IntelliJ
idea diff file1.txt file2.txt
Note this works with other JetBrains applications as well; for example, using WebStorm or PyCharm:
# Diff with WebStorm
webstorm diff file1.txt file2.txt
# Diff with PyCharm
charm diff file1.txt file2.txt
Reference
add a comment |
From the terminal, you can use the idea launcher directly like so:
# Windows
idea.exe diff path1 path2
# MacOS/Linux
idea diff path1 path2
At least for MacOS (I'm not certain of Windows), if you've created the Command-line Launcher via "Tools -> Create Command-line Launcher..." it's as simple as the following:
# Create some files to diff
echo "This is line 1" > file1.txt
echo "This is line 2" > file2.txt
# Diff with IntelliJ
idea diff file1.txt file2.txt
Note this works with other JetBrains applications as well; for example, using WebStorm or PyCharm:
# Diff with WebStorm
webstorm diff file1.txt file2.txt
# Diff with PyCharm
charm diff file1.txt file2.txt
Reference
From the terminal, you can use the idea launcher directly like so:
# Windows
idea.exe diff path1 path2
# MacOS/Linux
idea diff path1 path2
At least for MacOS (I'm not certain of Windows), if you've created the Command-line Launcher via "Tools -> Create Command-line Launcher..." it's as simple as the following:
# Create some files to diff
echo "This is line 1" > file1.txt
echo "This is line 2" > file2.txt
# Diff with IntelliJ
idea diff file1.txt file2.txt
Note this works with other JetBrains applications as well; for example, using WebStorm or PyCharm:
# Diff with WebStorm
webstorm diff file1.txt file2.txt
# Diff with PyCharm
charm diff file1.txt file2.txt
Reference
answered Nov 9 at 23:26
Joshua Hansen
6816
6816
add a comment |
add a comment |
In IntelliJ IDEA 2018.2, you can open an empty Differences Viewer and paste any text you want to compare in its left and right panels. The new Open Blank Diff Viewer action can be found in the Find Action dialog.
add a comment |
In IntelliJ IDEA 2018.2, you can open an empty Differences Viewer and paste any text you want to compare in its left and right panels. The new Open Blank Diff Viewer action can be found in the Find Action dialog.
add a comment |
In IntelliJ IDEA 2018.2, you can open an empty Differences Viewer and paste any text you want to compare in its left and right panels. The new Open Blank Diff Viewer action can be found in the Find Action dialog.
In IntelliJ IDEA 2018.2, you can open an empty Differences Viewer and paste any text you want to compare in its left and right panels. The new Open Blank Diff Viewer action can be found in the Find Action dialog.
answered Jul 27 at 13:09
Ruslan
1,076723
1,076723
add a comment |
add a comment |
Since 2018.2, IntelliJ has officially supported it:
For windows: Ctrl + Shift + A, then type "Open Blank Diff Viewer"
For Mac: Cmd + Shift + A then type "Open Blank Diff Viewer"
add a comment |
Since 2018.2, IntelliJ has officially supported it:
For windows: Ctrl + Shift + A, then type "Open Blank Diff Viewer"
For Mac: Cmd + Shift + A then type "Open Blank Diff Viewer"
add a comment |
Since 2018.2, IntelliJ has officially supported it:
For windows: Ctrl + Shift + A, then type "Open Blank Diff Viewer"
For Mac: Cmd + Shift + A then type "Open Blank Diff Viewer"
Since 2018.2, IntelliJ has officially supported it:
For windows: Ctrl + Shift + A, then type "Open Blank Diff Viewer"
For Mac: Cmd + Shift + A then type "Open Blank Diff Viewer"
edited Nov 20 at 21:39
answered Nov 20 at 16:04
nxhoaf
5,45283138
5,45283138
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14386488%2fusing-intellij-to-diff-two-arbitrary-files%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can: devnet.jetbrains.net/message/5299914#5299914 (search that forum for "diff command line" (or similar) for other similar threads)
– LazyOne
Jan 18 '13 at 12:13