8/10 step 1


#1

Why is this not working?


#2

Git is telling you why, your question suggests that you have not read the error message that it is providing you.

If you have read it, then you'll have to elaborate on what it is you're trying to do and why you think it should work and what thoughts you have on the error message.

You've got one explanation so you'll have to explain what's missing in it if you're to ask for another!


#3

I read it but I have tried committing it and it won't allow me to commit


#4

And it tells you why you may not commit it, doesn't it?

That's not in your screenshot, but if it's not letting you commit, it'll be telling you why! Follow those error messages.


#5

it gives me this error when I commit


#6

Okay.. did you read THAT error? It says there are no changes to commit.

Have you figured out what you want to be doing with the file?

Git refuses to overwrite it because it isn't saved anywhere else that it knows of. What do you want to do about that file? You always have to keep in mind what it is you're trying to do otherwise you're just.. pulling levers with no intention and I don't think that gets you anywhere and if it does then it's by accident.


#7

even when I change something and commit it I get the same error as before


#8

But you didn't commit it did you? Git told you there is nothing to commit, right?

You've got an unsaved file. You need to save or discard. You still haven't said which of those you're trying to do! You said you're trying to commit, but as Git tells you, you haven't told Git what to commit "no changes added to commit"


#9

If you want to save your changes, then you'll need to tell git that these are marked for commit, and then commit it.
If you want to discard it, simply delete the file.

You just have to decide on what you want to do.

My whole point here is that you have to decide what action you want to take. What do you intend? Nobody can tell you that. "Not working" is an insufficient problem description!


#10

nevermind it works now


#11

That's great. But the important part here is to understand what Git is saying and how to respond to it!