Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source Tree 1 branch ahead and 1 branch behind

I have a problem with my SourceTree repository. I don't know what I did but now I have 1 branch behind and 1 branch ahead. And if I try to pull I get error which is saying that I have uncommitted changes (but I dont have any) and if I try to push I get error and is saying that I need to pull first. If I try to merge my branch I also get error which is saying: "fatal: You have not concluded your merge (MERGE_HEAD exists).Please, commit your changes before you merge."

Here is a picture:

enter image description here

And here is a video: http://recordit.co/MYOgeSFTaD

Thank you for your time !

like image 755
Florentin Lupascu Avatar asked Oct 16 '25 18:10

Florentin Lupascu


2 Answers

Your distant origin/master and your local master are both 1 commit ahead.

1 behind means the distant repo is 1 commit further from your common base
1 ahead means your local workspace is 1 commit further from your common base

If you want to push your modifications you have to catch up distant commits (1 behind) and merge it with your local modifications (1 ahead). Press Pull, if there's no conflict (your edits aren't located at the same place as theirs) it creates a new commit for you, else you'll have to solve those conflicts first.

You'll then be 2 ahead but no longer behind. You can't push with commits behind. Just push your modifications.


I edit this after watching your video. There's conflicts in your workspace. Just click on File Status on the left side bar and solve these conflicts. Then commit, then push, as explained above.

like image 98
Crazyrems Avatar answered Oct 18 '25 09:10

Crazyrems


I fixed by pressing the Commit button and after I checked "Push changes immediately to origin" and effectively I commit nothing (0 files). But there was created a connection between the branch and master and now I don't have anymore errors. I don't know if is normal or not but this fixed my problem. Here is a photo so you can compare the first photo with this one:

enter image description here

Thanks !

like image 34
Florentin Lupascu Avatar answered Oct 18 '25 09:10

Florentin Lupascu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!