6

I have been pressing "No", but GitHub Desktop still lists it as being staged and ready to be committed. My partner, him, uses the Command Prompt and not GitHub Desktop, and has been pressing "Yes" and reports the same behaviour (the file gets committed).

So what exactly does this prompted message do ?

NOTE: We both use IntelliJ, which is the application prompting us this message.

EDIT: Adding the screenshot below for clarity. The green item is the result of me selecting 'YES' on the prompt, and the red item is the result of me selecting 'NO' on the prompt. We can see they both are presented in the GitHub Desktop application anyways. The question is thus: what does this prompt do?

The prompt

After prompt - showing results

Git status

EDIT: Current set up:

IntelliJ IDEA 2018.1 (Community Edition) Build #IC-181.4203.550, built on March 26, 2018 JRE: 1.8.0_152-release-1136-b20 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

GitHub Desktop 1.2.6

EDIT: Now updated IntelliJ to latest version:

IntelliJ IDEA 2018.1.6 (Community Edition) Build #IC-181.5540.7, built on July 11, 2018 JRE: 1.8.0_152-release-1136-b39 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o Windows 10 10.0

Here is a screenshot of the gitstatus (but both files still get listed in GitHub Desktop as being ready to be committed) :

Latest version IntelliJ screenshot

payne
  • 4,691
  • 8
  • 37
  • 85
  • Is version staged the same as current one in the working directory? – user4003407 Jul 11 '18 at 23:30
  • I believe the version of the file staged is indeed the same as the one that is in IntelliJ. That would need to be confirmed though. However, in itself, as far as I know, GitHub doesn't exactly have a way of organizing staged files, aside from `gitignore`: all modified files appear as ready to be committed. – payne Jul 12 '18 at 13:00
  • Is there perhaps a change in mode bits? – o11c Jul 13 '18 at 01:25
  • And what would that be ? – payne Jul 13 '18 at 01:41
  • @payne but after the update, `git status` is reporting the correct status according to your [screenshot](https://i.stack.imgur.com/Kvnoe.png): _Changes to be committed_ (`test123.java` file), _Untracked files_ (`test321.java` file). Is'n it? What does Github Desktop report about it? – lealceldeiro Jul 13 '18 at 14:39
  • GitHub Desktop still lists both as ready to be committed. – payne Jul 13 '18 at 17:21

2 Answers2

3

In order to see the exact command IntelliJ IDEA executes you can go to View > Tool Windows > Version Control (Alt + 9). In that view, you select the Console tab. See image below:

enter image description here

Once there you can see what it does exactly by adding a new file (Right click in project folder > New > Java Class). Let's call it "MyFile.java".

When the confirmation prompt shows up, if:

  • No is selected, nothing happens, the console shows nothing and the file remains "non-added" to version control.

enter image description here

  • Yes is selected, the following command is shown in console:

    14:48:46.853: [valuedemo] git -c core.quotepath=false -c log.showSignature=false add --ignore-errors -- src/main/java/com/lealceldeiro/valuedemo/MyFile.java

The relevant part here is git -c core.quotepath=false -c log.showSignature=false add --ignore-errors -- src/main/java/com/lealceldeiro/valuedemo/MyFile.java, which basically adds the file "MyFile.java" with the core#quotepath and log#showSignature values to false and ignoring any error.

If you have any doubts about the state of the files you can use git status and if there is a file you do not want to commit you can use git rm. Actually if we want to remove our previously added "MyFile.java" through the IDEA UI, we can do Right click on the file > Git > Revert > Revert and it will print in VCS console git -c core.quotepath=false -c log.showSignature=false rm --cached -f -- src/main/java/com/lealceldeiro/valuedemo/MyFile.java


See more about:


Tested with IntelliJ IDEA 2018.1.5 (Ultimate Edition), Build #IU-181.5281.24, built on June 12, 2018.

lealceldeiro
  • 14,342
  • 6
  • 49
  • 80
  • First, I figured out it's "Alt + 9". Maybe that's just on my version of IntelliJ. Second, you are right, creating a new file did prompt this message, and that window you advised me to look into does behave as you have mentioned. Third, I'm not sure you've answered my question. Look at [this screenshot](https://i.snag.gy/aEU0Wj.jpg): in green is the 'YES' added item, and in red is the 'NO' added item. We can see they were both added into the GitHub Desktop application. So what is the difference ? (I edited my question to add the screenshot.) – payne Jul 13 '18 at 00:40
  • @payne you're right about the key combination (I missed it). Also, can you confirm the status of both files ( the added one and the non-added one ) when you do a `git status` from command line?? – lealceldeiro Jul 13 '18 at 13:11
  • @payne I'm asking because the prompt, regarding to the CVS, shouldn't do anything but what's shown in the CVS console. Sadly I don't have Window right now for installing [Github Desktop](https://desktop.github.com/) (is this one, right?). – lealceldeiro Jul 13 '18 at 13:16
  • @payne I don't know if it's something related to _git | IDEA_ version. I repeated the same with two files `test1` and `test2` ([screenshot](https://i.stack.imgur.com/cjIxV.png)), and it is different from yours. Your new file (green) is also being shown in red in the area _"Changes not staged for commit"_. For me it is only listed in _"Changes to be committed"_, the other one is in _"Untracked files"_. Maybe post your tools version for more precision in order to see if someone throw some light on this. – lealceldeiro Jul 13 '18 at 13:44
  • I've updated the Original Post with my set up (versions). – payne Jul 13 '18 at 14:10
  • 1
    @payne OK. Have you evaluated the possibility that this maybe is not an IDEA issue but a GitHub Desktop issue. Have you reported this on the [GitHub Desktop issues](https://github.com/desktop/desktop/issues). Here are some similar ones: [#4133](https://github.com/desktop/desktop/issues/4133), [#4953](https://github.com/desktop/desktop/issues/4953) – lealceldeiro Jul 13 '18 at 14:12
  • I have no idea, hence me asking around here. I've updated IntelliJ to the latest version, and I've updated OP with a screenshot of the `gitstatus`. – payne Jul 13 '18 at 14:32
0

I think in github-desktop, the UX makes it look like all the files are staged. But apparently, only while making the commit, it stages and it's been committed git commit -a _message_.

You could see the difference in the terminal using git status command. Or using IntelliJ itself using VCS control.

There are several issues related to this UX experience

Thiru
  • 2,541
  • 4
  • 25
  • 39