Git pushing to remote origin—changes are not commited in origin, only visible after git stash

On my local machine I have cloned a remote repo, made some changes, commited, then pushed back to the remote repo which has NOT been touched in any way in the meantime.

On the remote machine when I look in the remote repo, I don’t see the changes I made. git status tells me that there are changes to be committed. When I look into the files, I do not see any of the changes I made. When I do git stash in the remote branch, I see the changes. So somehow git does not commit the pushed changes in the remote repo.

  • Meaning of leading slash in `.gitignore` file
  • ssh key file unprotected private key file error every time after reboot
  • Unable to execute git push from Package Manager Console with GitHub for Windows installed
  • Git pre-push hook not working
  • Move files to another repository with the tags
  • Git, different downstream and upstream remote branch
  • Could someone please explain the logic behind this to me and how I can circumvent this situation? Can I somehow push changes to the remote repo without having to git stash?

    Thanks a lot for the clarifications!

  • Best practices on GitHub repos, to Fork or create a New Branch
  • Git Revision Expression
  • setting up TeamCity to pull multiple git repos with named locations
  • Git workflow for merging remote ‘origin/develop’ into ‘origin/master’
  • Alias for “git checkout main_branch; git merge topic_branch”?
  • Git: massive refactor keeping changes log
  • One Solution collect form web for “Git pushing to remote origin—changes are not commited in origin, only visible after git stash”

    If you are pushing into a a remote that has a checkout-out working copy you will not see the changes automatically. git is pushing the changes into the repository (the .git directory). If you want to update the associated working copy, you would need to implement the appropriate logic in the post-update hook.

    In general, git won’t even let you push to a remote with an associated working copy without explicit configuration…you would typically see an error along the lines of:

    remote: error: refusing to update checked out branch: refs/heads/master
    remote: error: By default, updating the current branch in a non-bare repository
    remote: error: is denied, because it will make the index and work tree inconsistent
    remote: error: with what you pushed, and will require 'git reset --hard' to match
    remote: error: the work tree to HEAD.
    remote: error: 
    remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
    remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
    remote: error: its current branch; however, this is not recommended unless you
    remote: error: arranged to update its work tree to match what you pushed in some
    remote: error: other way.
    remote: error: 
    remote: error: To squelch this message and still keep the default behaviour, set
    remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
    To /home/lars/repo1
     ! [remote rejected] master -> master (branch is currently checked out)
    error: failed to push some refs to '/home/lars/projects/administrivia/repo1'
    Git Baby is a git and github fan, let's start git clone.