GIT push not pushing commits to remote

I have been working on a git repository and have been pushing my local changes to a remote server all the time… up until recently. When I do a git push, it says that everything is up-to-date. In reality, I’m already 3 commits ahead of the remote version and it’s not getting my changes.

I have tried the git log -1, git reset –hard solution posted on various places, but that doesn’t solve anything. Do I need to change that number to reflect the number of commits that I am ahead?

  • How to see difference of first and third commit in git?
  • Why does GitHub invite me to enter two commit messages instead of just one?
  • git commit fix to project owner
  • How do you merge two Git repositories when one is a subdirectory of the other without losing commit history?
  • git keyword expansion after commit
  • How to configure Git post commit hook
  • Say I have 5 commits, for brevetys sake named 1 to 5. My local version is at 5, the remote version is at 2. Gitk shows my MASTER at commit 5 and remotes/origin/master at commit 2. Do I need to git reset my local version to 2 (or 3, the first commit that was not pushed to remote)? What will happen to my changes? The git documentation says that –hard will discard any changes, will that mean that they will be lost completely? I would like to keep the commit history of these 3 commits, as there were quite some changes made.

  • Can I prevent people from forking my code?
  • Update a submodule to the latest commit
  • Sprockets::FileNotFound: couldn't find file '../../fonts/bootstrap/glyphicons-halflings-regular.eot'
  • Standalone git hooks or Jenkins?
  • In git, what is the difference between long and short hashes?
  • Git objects SHA-1 are file contents or file names?
  • 2 Solutions collect form web for “GIT push not pushing commits to remote”

    First of all carefully examine your configuration.

    1. Make sure you have pushed it really.
    2. Make sure you have pushed it to where you THINK you pushed it.

    What can help you:

    $ git log --full-history // is your commit really there?
    $ git reflog // operation history
    $ git remote -v // what are your remotes? 
    $ git remote show DESIRED_REPO // do you have the remote repo you wanted to push to configured? the DESIRED_REPO?

    Finally, make sure you are using RIGHT push notation:

    1. There is a difference between git push public and git push --repo=public. First pushes to public ALWAYS, second only if remote for branch you are pushing is not set.
    2. If your branch is named differently than it’s remote counterpart, this can make a difference.

    $ git push remote local_branch:remote_branch // I've made this error today by swapping places, with remote_branch:local_branch Git will not find the branch to update.

    Hope this helps. In my case careful re-reading of manual while re-examining commands I’ve tried helped and revealed the problem (swapped branch names).

    I was in the same situation a few minutes ago (which is why I wandered into this thread). Anwyay, I was able to solve it via git push origin master instead of just git push.

    This happened after I created a new branch, started pushing to the new branch, then went back to the master branch and tried to push to that branch again.

    Git Baby is a git and github fan, let's start git clone.