3

I’m having some issues with a project using Git I’m working on. I'm using a non-bare repository for that.

After committing some local changes, when I run:

git status

I get:

Your branch is ahead of ‘origin/master’ by 1 commit.

Nothing wrong with that. But when trying to push local committed changes to a remote repository with:

git push origin master

And I’m having the next error message:

Branch master -> FETCH_HEAD Error: Your local changes to the following files would be overwritten by merge. Please, commit your changes or stash them before you can merge. Aborting

When I run

git status 

after that I get:

Your branch is up-to-date with ‘origin/master’

However, when I take a look at my remote repository, those changes weren’t really pulled.

Many people have had the same issue but it was always after a pull request never, which seems to make a bit more sense, never after a push. Also, I have no commits to make.

MiGU
  • 382
  • 3
  • 17
  • Please do not capitalize lowercase commands (e.g. write `git`, not `Git`). – jub0bs Jul 13 '15 at 15:44
  • How is your remote repository set up? I'm guessing it isn't a bare repo. – Hasturkun Jul 13 '15 at 15:58
  • You're right! I just checked it (by running 'git rev-parse --is-bare-repository') and it's not (the previous command is returning 'false') – MiGU Jul 13 '15 at 16:19
  • I had a theory which turned out wrong (I failed to replicate your issue). Do you have any hooks set up on the remote repository? which version of git are you using? – Hasturkun Jul 14 '15 at 08:25
  • Possible duplicate of [How to ignore error on git pull about my local changes would be overwritten by merge?](http://stackoverflow.com/questions/14318234/how-to-ignore-error-on-git-pull-about-my-local-changes-would-be-overwritten-by-m) – kenorb Mar 16 '16 at 12:45

2 Answers2

0

i know that this could be a simple and obvious question to ask you, but, what is the branch from you are trying to push to master ? are you working in the master branch locally ? if you are in another branch that isn't master locally, your push will ignore the changes of the current branch.

0

I know it's been a while since I asked this question, but the problem was related to a hooks set up on the remote repository by one of my colleagues that I've never hearded about.

MiGU
  • 382
  • 3
  • 17