Why's the button "Commit" greyed out in Android Studio? - java

I want to commit my changes to my project to GitHub but for some reason, the "Commit" button is greyed out in Android Studio. I can't seem to spot what's causing this issue. Even when I write a message, it's still greyed out.
How would I fix this?

You have to make sure those files are blue (or green if new files). Hit Cancel, go back out to the app. Right click app at the top and goo down to git then add all. That will add all of them. Then, you will be able to commit and push your changes. However, you also need to make sure you click on the checkbox.

Add files you want to commit:
git add <file_name>
or to add all of them:
git add .
Commit files (using IDE or console - for now button should be active):
git commit -m "message"
Commit files using IDE - remember add message to commit

If there are files with red color mean you have not added them to git.
Right click on the file->Git->add
Then you can commits the changes.

Related

IntelliJ showing code changes (Git)

When I make code changes in IntelliJ, the IDE will show me which lines I've added/modified by color-coding next to the line number.
However, when I commit my changes (git commit ...), then the helpful color-coding disappears. Is there any way to still show the line changes even after I commit them?
It's not 'color' solution but if you right-click on left (might be a line number) and select annotate then you will see some details about git changes in whole file:
If you click on one of them then more info will popup:

File from non-active change list is modified

I've opened my project in the morning and this line appeared in the Gradle app module.
There are three options : Move changes, Save Changelist and Ignore.
Does someone have an idea what's wrong and what I should do?
There was a open bug in IDEA regarding this issue:
IDEA-51396 Tasks: if conflicted file is opened in 2 editor tabs, tasks toolbar actions (switch changelist/move changes/ignore) don't make toolbar disappear
It's the IDE behaviours and you don't have to worry about it at all.
Choose what options suits you the best and continue your work.
It is related to source control of android studio. If you do not use inbuilt source control of studio just ignore it. If yes, then you can save the changelist and commit later.

How to restore shelved changes in Intellij when the shelf tab is not shown?

I tried to use the "shelf" feature for the first time in IntelliJ IDEA today. I shelved all my current changes so that I could work on a quick bugfix, commit it, and come back to my current work afterwards.
When I commited the "shelf" action, IntelliJ created the shelf and I could see it in the tool window. Then it reverted, and reloaded the project.
Now the shelf tab in the Changes tool window does not appear any more.
However in the file system I can see the patch file under .idea/shelf.
Why ? I suspect the problem is that the .idea directory is itself under version control. So when I shelved the changes, it file was included in the shelved changes, and then it was reverted, and IntelliJ is not aware of the shelved changes any more.
I am using Git.
How can I make IntelliJ aware of the patch file in the change tool window ? Or if impossible how can I restore these changes based on the patch file only ?
And how to use this feature in the future without encountering this problem ?
Is it a bad practice to keep the .idea directory in te VCS ?
The answer to the
How can I make IntelliJ aware of the patch file in the change tool
window ?
question was :
Create a bogus shelved change so that the "shelf" tab is available. It will not show if there are currently no shelved changes.
Right click in the "shelf" tab, select "import patch file", pick the previously create patch file. This creates the "shelf"
You can now "unshelf" the changes normally
Finally, I had to manually merge the workspace.xml file. After this, I think I will think about stopping to commit IDE project files to VCS. At least when it is a trivial task to recreate the IDE project from e.g. a checked out Maven project.
If you are ever lose the Shelf tab in a Jetbrains IDE, you may have shelved too large of a file (a 1.81 GB .patch in my case). You can view all of your patches in the Jetbrains shelf by going to:
/.idea/shelf
Delete the really large patch file and restart the IDEA and the Shelf tab reappears on the Git area .
If you don't see your .idea folder in your IDE, follow these steps:
Help > Find Action...
Search "Registry" and click the found action
In the Registry search "dot.idea" and uncheck the checkbox in the Value column for the projectView.hide.dot.idea Key
I had similar issues, but shelving bogus changes did not help (was using WebStorm, but the underlaying IDE is the same). The shelf window did not show up no matter what I did. Even though the shelved changes were created in the .idea/shelf folder. What actually in the end helped was moving/deleting .idea folder under the project completely (good to backup before deletion). And restarting JetBrains IDE.
For anyone (like me) still running into this issue:
The shelf tab is most likely there, but not displayed due to the width of the commit tab.
In the top right of the commit tab there are 3 icons:
arrow down
cogwheel
minimize
On the ARROW DOWN you see all the "hidden" tabs, which includes the tab "Shelf" for me.
Or you make the commit tab wider then you should also see the tabs at the top.

How to create a patch in IntelliJ IDEA?

I've been using IntelliJ IDEA 9.0 Community Edition for some time after years living in Eclipse. One thing seems to be hard to find in it. I'd like to create a patch on some subfolder in my project. In Eclipse it is done using right click, Team, Create Patch.
Does anybody know how to do that in IDEA?
Use the Changes view. In the group by directory mode you can right click on the directory with changes and choose Create Patch from the context menu.
You can do a right click Local History -> Show History and then choose a revision and click on patch button (the second from the left)
From the top corner, click on Git -->patch--> create Patch from Local Changes
In the Local Changes tab or the Repository(SVN)/Log(Git) tab of the Version Control tool window, select a change or changelist you want to create a patch for and click Create Patch from the context menu.
P.S. relevant for all versions

Can't commit to Subversion from NetBeans

When I change some interface things in Java, like the contents of a menu item, and save them, the commit option does not enable. NetBeans does not know that changes have been produced so I cannot commit them. How can I commit them?
Can you commit from the console?
try svn stat in the root directory of your project, that should show you the files that have been modified with an M near the name of the file. if you can see them, run svn ci to commit all changes.
Maybe (and just maybe), svn is ignoring those files on purpose, to check if this is true, run from the console svn propedit svn:ignore .(<- this dot is necesary) in your project root to check if that directory/file/file extension is being ignored.
Good luck!
Are you using Netbeans 6 or higher? If not, you need to tell Netbeans where the svn executable is (see the link and the associated FAQ).
Are you sure that your subversion repository is running on a machine that is in sync with your workstation's view of the current time (e.g., synch-ed via ntp)? If the time is enough out of sync, it's possible that the subversion module is missing the update and, therefore, not flagging the change.
Also, you should check to make sure that you have an active valid connection to the subversion repository. You can easily do this for the file you just edited: right click on the editor tab for that file and choose Subversion -> Diff or Show Changes or Search History. If any of those fail, your IDE has lost its connection to SVN for some reason.
Another possibility is that you didn't succeed with a real checkout: if the .svn subdirectories aren't properly configured, the menu item will definitely be disabled. I would recommend that you right click on the project (under Projects) and try Show Changes. If that doesn't succeed, you don't have a valid Subversion checkout and the Netbeans options definitely won't work.
If for whatever reason netbeans isn't allowing you to commit, I would suggest either doing it from the commandline, or using a program like TortoiseSVN
It is Subversion's responsibility to know what has changed since the last commit/update. If NetBeans' Subversion interface doesn't allow to commit, then it may be a bug in Netbeans. Technically, there should be no reason to disable commit button - Subversion doesn't prevent you from committing even if nothing has been changed.
Right Click the file which is marked as red color, select resolve confilcts
and try to commit now...

Categories

Resources