简体   繁体   中英

git push gets “Everything up-to-date” after committed

This is the 2nd time I push my code, and it says Everything up-to-date. The repo in GitHub does not reflect any changes.

The first time is when I set up the git repo on github and followed the set up tutorial:

http://help.github.com/create-a-repo/

But this time I modified those files and try to

 git commit -m "msg";
 git add file;
 git push origin master; 

The changes did not reflect on the remote page. anyone know how can I summit the changes to github?

You first add a file, then commit and then push.

Do this instead:

git add file;
git commit -m "msg";
git push origin master; 

I won't repeat already provided answers, but this might of use. If you run git status in your working directory you'll get a summary of the current state of your checkout. No doubt it'll show something along the lines of:

# On branch master
#
# Initial commit
#
# Changes to be committed:
#   (use "git rm --cached <file>..." to unstage)
#
#   new file:   file
#

You can use this information to diagnose exactly what is going on. In our current situation we could gather that nothing has been committed as we've got a file in the Changes to be committed section.

您需要提交之前添加文件而不是之后。

When you commit, git checks if the file has changed, not it's time stamp . This can be confusing, as your file's time stamp (file mtime) may be younger than the previous commit, and nothing happens.

(like if you type a space, then delete it, then save)

When that happens, make a real change to the file, like adding an empty line, save and commit again.

(Oh, and - obviously - when you "add", you have to "commit" before pushing)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM