user852690
user852690

Reputation: 111

Git push rejected after cloning

I cloned a repo from bitbucket using git clone. I made some changes and then git commit. Now I'm trying to push but I get a Updates were rejected because the remote contains work that you do not have locally.

Now, I'm sure that remotely nothing changed between my git clone and my git commit.

Of course I can do a git pull but I'm scared to loose all changes I've committed.

How can I check what exactly is preventing my push?

Upvotes: 1

Views: 729

Answers (1)

miw
miw

Reputation: 764

Do a git fetch first. That will download any remote changes, but not attempt a merge yet. Then you can look at the difference between your branch and the remote= cloned branch and decide what to do. A git pull would initiate a merge, btw, so you would not loose anything unknowingly.

Upvotes: 3

Related Questions