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
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
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:
And these are my commits in bitbucket.Any idea on how to get them synced again?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
All your recent commits are on Master, but you're pushing master. The capital M makes a big difference here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Aha, and how do I solve this issue? Can i get rid of the double M/masters? And sync to bitbucket again?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are the commits from big-M Master now available in small-m master on your local system? What about on Bitbucket?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.