Sarah Sh Sarah Sh - 2 months ago 109x
Git Question

Cannot do push / pull in git - working with visual studio

I have made a lot of changes, when I am trying to push them - I am getting the next error:

You cannot push branch master to remote origin because there are new commits in the remote repository’s branch. Pushing this branch would result in a non-fast-forward update on the branch in the remote repository.

When I am trying to pull the changes I get:

Cannot pull because there are uncommitted changes. Commit or undo your changes before pulling again. See the Output window for details.

I dont have any uncommitted changes...

I am stock from both ways and dont know how solve this issue.

*not long ago I run the command: git rm --cached in order to solve a git ignore issue. could be it is connected?


Try this procedure:

stash your local commits Try to get the changes and then push:

$ git stash

pull from master:

$ git pull 

get your local changes back after pulling the master branch

$ git stash pop

commit your local changes

$ git commit


$ git push