Local and Remote Repo not Synced

Joost van der Steen May 30, 2017

Hi there, I'm pretty new to GIT and Bitbucket and I have run into a problem because I'm new to this. My repo on bitbucket is not in sync with my local but when I'm trying to push my local repo to bitbucket it says everything is the same so nothing happens.

Everything was working fine until Git was telling me I couldn't push, being sure of what I thought was the solution I force pushed to bitbucket.

The force didn't do what I expected, on bitbucket I have 4 commits with the last one on the 13th of may. So by force pushing it didn't push my last commit but it somehow removed a few commits.
Locally I see 10 commits with the last one today. When I try to push it again it says there are no changed even though the commits are different and the code should be too.

I don't know exactly what I've done wrong an how I can solve this so that the commits I see locally are also on bitbucket.

Hope someone can help me with this,

Thanks in advance,

Joost 

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2017

Hi Joost!

Have all the files been staged and commited? You can get the status of your local repository and see how your local project is progressing in comparison to your Bitbucket repo. If there are any untracked files, that means that Git does not see them as part of a previous commit and thus, they'll be invisible for Bitbucket. To check the status you can use:

git status

If there are untracked files, you'll need to tell Git to track them. To do so use:

git add <file_name>

Now that all your files have been staged, you can commit them and then push using:

git push origin master

To learn more, please visit Copy your git repository and add files.

If get status was not showing any differences between your local repo and Bitbucket, please let us know so we can help you further.

Cheers!

Ana

Joost van der Steen May 31, 2017

Hi Ana,

Thanks for your help, I always use

git add .

to track my files, and as you suggested I tried

git status

but this is the reply

On branch master
nothing to commit, working tree clean

This is my local log in my phpstorm editor:
Schermafbeelding 2017-05-31 om 20.43.19.png

And these are my commits in bitbucket.Schermafbeelding 2017-05-31 om 20.42.51.pngAny idea on how to get them synced again?

Thanks!

jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2017

All your recent commits are on Master, but you're pushing master. The capital M makes a big difference here.

Joost van der Steen May 31, 2017

Aha, and how do I solve this issue? Can i get rid of the double M/masters? And sync to bitbucket again? 

jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 31, 2017

Based on the phpstorm snapshot, you should be able to do a fast-forward-only merge from Master into master, then push master and delete Master:

git checkout master
git merge --ff-only Master
git push origin master
git branch -d Master
Joost van der Steen June 1, 2017

Thanks Jim, when i try to merg it says:

Already up-to-date

So it seems the merge is not working. Sorry I feel a bit dumb to ask for everything but I'm a bit worried that when I try something I make a total mess of this :D.

 

Joost van der Steen June 5, 2017

Hello Ana or Jim,

 

Could you help me further with this problem I have? Merge doesn't seem to work. Hope one of you can help me.

Thanks,

Joost

jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 5, 2017

Are the commits from big-M Master now available in small-m master on your local system? What about on Bitbucket?

Joost van der Steen June 6, 2017

No nothing was changed but I tried different stuff yesterday and got it solved.

I first reset my local repo to the point where my remote repo at bitbucket was at. I then added, committed and pushed everything from local to bitbucket.

Then on my own remote server I fetched, and reset --hard to get this one in sync aswell.

So everything is working perfectly now. Still don't know where the M-aster came from. I tried to reproduce it but that didn't work.

Well thanks a lot for all help!

Joost

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events