Search code examples
gitgithubversion-controlgit-push

git push -u origin master command is not reflecting changes on github


I did 4 commits in my project till 3 commits I was able to see changes on GitHub but after 4rth commit it is not showing changes online.

git log --oneline

0d2084d (HEAD) fourth commit
a3fb0e9 (origin/master, master) third commit
89d2764 second commit
c600e93 first commit

git push -u origin master

Everything up-to-date
Branch 'master' set up to track remote branch 'master' from 'origin'.

on GitHub: enter image description here


Solution

  • From the output of git log --oneline, we can see that the 4th commit is on a detached HEAD instead of master. master does have only 3 commits. This detached HEAD could most probably be caused by git checkout a3fb0e9 or git checkout origin/master.

    To apply the 4th commit onto master, you can

    git checkout master
    git merge 0d2084d
    

    And then run git push origin master to push the 4th commit to the remote repository.