Jason Tian
Jason Tian

Reputation: 23

cannot see the local commits on git status

Help, please ~

I encountered a question that I cannot see the local commits on git status after i add&commit my files,

$ git status
# On branch gh-pages
nothing to commit, working directory clean

as we know, normally I should see a message on git status, for example,

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)
# nothing to commit, working directory clean

now there is no (use "git push" to publish your local commits) message to remind me.

But I can push them on github successfully,

$ git push
Username for 'https://github.com': <hidden>
Password for 'https://<hidden>@github.com':
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 1.06 KiB | 0 bytes/s, done.
Total 6 (delta 1), reused 0 (delta 0)
To https://github.com/<hidden>/xxx.git
 f4a2f13..c6b5492 gh-pages -> gh-pages

Upvotes: 1

Views: 318

Answers (2)

Maor
Maor

Reputation: 118

When you switch from master to gh-pages, is it telling you its up to date with origin/gh-pages ?

If not, have you set up an upstream branch tracking? if its a new branch do

git push -u origin gh-pages

Keep in mind that message only shows when your local branch is either ahead or behind remote branch, (when doing git status), when you switch from a branch to another it should tell you if it's behind, ahead, or even.

Upvotes: 2

Ruslan Ostafiichuk
Ruslan Ostafiichuk

Reputation: 4692

git status will not show you commits

Use git log for that.

Upvotes: 1

Related Questions