Royi Namir
Royi Namir

Reputation: 148524

Git shows differences even after `push --force`?

Simplification :

enter image description here

In my master branch I've added some garbage.
Then I pushed it to origin/master

Later I've discovered that it was a mistake to add that garbage. I know I can/should create a revert commit.

But I didn't. I did a git reset --hard

enter image description here

But now I want that the origin/master will look exactly the same as my local.

Obviously I can't push becuase git tells me to pull before push.

So I did push --force:

enter image description here

But even after that , sourcetree shows that they are not the same :

enter image description here

Even though if I check for changes , I see no changes :

enter image description here

Question:

If remote master and local master has no differences , why does sourcetree show me pull ?

enter image description here

Even git status shows I'm ok (without pull) :

enter image description here

Upvotes: 2

Views: 117

Answers (3)

LogicalAnt
LogicalAnt

Reputation: 963

SourceTree checks the remote status periodically.

Solution 1: Simply reopen the Sourcetree

Solution 2: Tools>Options>General check default remotes for updates every X minutes. Make the X to 1/2 to get to see the status change faster. Like as the image you can see the updated status after 1 minute.

change remote update time

Hope this will help.

Upvotes: 1

Enrico Campidoglio
Enrico Campidoglio

Reputation: 59913

Sometimes Sourcetree gets out of sync with your local repository. When this happens, simply tell Sourcetree to refresh its view with F5 (Windows) or +R (macOS).

Upvotes: 1

Acorn
Acorn

Reputation: 26066

General advice: whenever a GUI that wraps a CLI program or library seems to misbehave, it is a good idea to check directly with the actual CLI program or library.


In this case, running a fetch:

git fetch origin

And then checking where the branches point to using:

git log master origin/master

Or perhaps:

git branch --all --verbose

Or even:

git show master
git show origin/master

allow you to check to which commit (hash) the branches actually point, and therefore confirm (or not) whether the GUI has a problem.

Even if you confirmed that SourceTree does not show the issue when reopening it, I would double-check with Git directly, just in case.

Upvotes: 1

Related Questions