Why can't I commit? (Your branch is updated with "origin / master", no changes have been added to commit)

I'm having trouble writing a file to GitHub. I can do this before git add, but as soon as I try $ git commit -m 'my message' , I get an error message preventing me from completing the file upload process.

 $ git add HelloWorld.md $ git commit -m 'Hello world' 

I get the following answer (deleted: README.md and .DS_Store are in red):

 On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: deleted: README.md Untracked files: .DS_Store no changes added to commit 
+6
source share
4 answers

If you modified the file but still have nothing to do, you may not have added the file to git. (or replace it after adding). Try adding the file before committing:

 git add filename.ext 

Or just add the whole directory:

 git add . 
+3
source

Apparently, you did not change anything in the HelloWorld.md file (or it does not exist at all), so there is nothing to accomplish. If you just want to add an “empty” file, first make sure touch HelloWorld.md , so the file is actually created. If it exists, edit it (for example, using vim HelloWorld.md ) and be sure to save the changes in your editor when you are done.

After you have done this and the actual changes to the file have occurred, you can commit it.

+1
source

You have nothing to do . More specific:

  • README.md was a tracked file, but you deleted without using git rm README.md . Git discovers that the file has been deleted, but you still have to perform this deletion if you want the latter to be effective the next time you commit.
  • .DS_Store - file without a trace; as such, it cannot be part of the next fixation. (By the way, you should ignore such files around the world .)
  • git add HelloWorld.md has no effect: the file is tracked by Git, but there is nothing to create there because you just haven't made any changes to it since the last commit.

    How can i say If HelloWorld.md was a previously unverified file or was a tracked file that you have changed since the last commit, git add HelloWorld.md successfully made these changes; it would be something to fix, and you could successfully complete.

Make some changes, make them, and then you can make it. Finally,

Your branch has been updated using "origin / master"

just means

You did not create any commits on master since you clicked on origin/master .

Nothing to worry about.

+1
source

'git add.' worked for me on the same problem.

0
source

Source: https://habr.com/ru/post/985364/


All Articles