So in order:
Check which files are staged for commit, and which have been committed:
Stage one file to to committed:
git add filename
Commit anything in staging (so currently that one file) with a message attached:
git commit -m 'message'
Not really relevant here:
Following isn’t quite true, if you ran
git status again, whatever
filename is would have moved from being listed as unstaged to being listed as commited:
- that didn't do anything
Push committed files. You committed one, so that’s what gets pushed:
git push origin master
Now nothing to commit, you haven’t added anything new:
git commit -m 'new msg'
Now nothing to push, you haven’t added or committed anything new:
git push -u origin master
no changes added to commit (use "git add" and/or "git commit -a")
Nothing to commit, you haven’t added anything new:
git commit -a
Then you’ve done something, possibly reset everything? You now have a repo pushed up to GitHub with that one file, so:
Running this should have given you some information:
Add all the files locally:
git add .
Commit everything that’s been added:
git commit -m "some commit message"
But you already have something on GitHub, and after whatever you did, GitHub is now possibly ahead of where you are now locally. As it is, I assume there’s just that one file, but git doesn’t know that it would actually be safe to override and push up everything even though there seems to be a duplicate. So when you do this:
It fails, you need to
pull the changes down from GitHub first, which will ensure you are up to date, then you can push safely