git status (nothing to commit, working directory clean), however with changes commited
Your local branch doensn't know about the remote branch. If you don't tell git that your local branch (master) is supposed to compare itself to the remote counterpart (origin/master in this case); then git status won't tell you the difference between your branch and the remote one. So you should use:
git branch --set-upstream-to origin/master
or with the short option:
git branch -u origin/master
This options --set-upstream-to (or -u in short) was introduced in git 1.8.0.
Once you have set this option; git status
will show you something like:
# Your branch is ahead of 'origin/master' by 1 commit.
git status
output tells you three things by default:
- which branch you are on
- What is the status of your local branch in relation to the remote branch
- If you have any uncommitted files
When you did git commit
, it committed to your local repository, thus #3 shows nothing to commit, however, #2 should show that you need to push or pull if you have setup the tracking branch.
If you find the output of git status verbose and difficult to comprehend, try using git status -sb
this is less verbose and will show you clearly if you need to push or pull. In your case, the output would be something like:
master...origin/master [ahead 1]
git status
is pretty useful, in the workflow you described do a git status -sb
: after touching the file, after adding the file and after committing the file, see the difference in the output, it will give you more clarity on untracked, tracked and committed files.
Update #1
This answer is applicable if there was a misunderstanding in reading the git status output. However, as it was pointed out, in the OPs case, the upstream was not set correctly. For that, Chris Mae's answer is correct.