Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git commit not possible. There are no staged files

I am using EGits with Eclipse and running into some issues.

I have one change from head; I have made one new class.

When I right click on this class and click "push", the following dialog shows and I cannot get past it :

Dialog box with "Committing is not posssible. There are no staged files".

Anyway, I need to push this file because I can't commit in real life, and now I cannot commit in Eclipse either and it's taking it's toll mentally.

Thanks.

PS I have googled this extensively looking for an easy fix (like a "stage" button) and found nothing.

like image 699
Simon Kiely Avatar asked Jul 27 '16 11:07

Simon Kiely


People also ask

Why are some files not staged for commit?

The “changes not staged for commit” message shows when you run the “git status” command and have a file that has been changed but has not yet been added to the staging area. This is not an error message, rather a notification that you have changed files that are not in the staging area or a commit.

How do you handle changes not staged for commit?

Changes to files are not staged if you do not explicitly git add them (and this makes sense). So when you git commit , those changes won't be added since they are not staged. If you want to commit them, you have to stage them first (ie. git add ).


1 Answers

using EGit: Right click it and navigate to Team => Add.

after then Push the code

Before pushing the file add that new file on git using terminal

git add after then

git push origin branch

like image 172
Anil Kumar Avatar answered Oct 05 '22 06:10

Anil Kumar