How to merge an already (partly) merged branch?

Hi all,

This is a bit of a complex problem but I'll try to keep it short.

I merged a branch (lets call it X) into my working branch (lets call it Y). Now, unfortunately for me I have to go through each file from X and check if it's 'safe' to use - discarding chunks from certain files, keeping other lines, etc.

While working on Y -- through Sourcetree -- I have been staging files and committing (and pushing) once I know they are 'safe'. So I have a remote and local branch (Y) that is now almost completely good to go.

Then something bad happened and I removed the remaining 'yet to be cleaned / checked' files from my unstaged changes and restarted Sourcetree - I did this thinking that when I remerged X, it would detect that Y had already accepted most of X's files (or that I hade made changes -- making them more up to date than X) and display those remaining files that had yet to be staged from before. This did not happen.

I now have all the changes I have 'cleaned' / saved and committed, but remerging X does nothing - Sourcetree seems not to recognize that X and Y still have differences and that Y doesn't have newer / more up to date files than X (in some cases).

This is despite the fact that running git diff X..Y shows all the differences I need to track!!!!

Please help
Foxy

1 answer

Okay I managed to figure this out... mostly by accident haha.

So since my current 'remote' and working copy branch (Y) had all the changes I wanted, I reset branch Y to a state PRE merge with X, but as 'mixed' (keep working copy changes).

This allowed me to just re-commit the working copy changes to Y and then merge from X (had to do a force push to update the remote branch Y but this was no biggie). The remaining files (which I had yet to clean) now appeared again, letting me finish my days work.

If anyone else has this issue, this will hopefully solve it for you too.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

790 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you