Sarah Sh
Sarah Sh

Reputation: 519

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?

Upvotes: 1

Views: 5305

Answers (1)

chenchuk
chenchuk

Reputation: 5742

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

push

$ git push

Upvotes: 4

Related Questions