Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

SourceTree Push, Stash pull request, Reverting Merges

Aaron Shelley July 30, 2013

I think I've been screwing up my pushes to my team's repository. Whenever I make a pull request for a new feature branch that I just pushed, all previous feature branches are attached to the newest pull request.

I think what is happening is, after I push a feature, I finish the feature and it gets merged to my develop branch. Then I create a new branch from develop (which has the previous feature merged to it) and after I push and do a pull request, the previous feature branch is attached to my new pull request.

So my question is, how do I revert the merge of a feature branch to my develop branch after having finished and deleted the feature branch?

What is a good practice for pushing new feature branches and closing them out when finished?

Right now I...

create new branch, commit changes, push, pull request, finish/delete branch.

create new branch after finish/delete of old branch and continue with above steps.

So when i'm tackling 5 features, one after the other, I get 5 pull requests each containing the previous feature's commits.

Do I need to wait to finish/delete my feature branches until after the pull request is merged?

I.E.

create new branch, commit, push, pull request

create new branch, commit, push, pull request

create new branch, commit, push, pull request

branch 1 and 3 are merged

finish/delete branch 1 and 3?

3 answers

1 accepted

2 votes
Answer accepted
Aaron Shelley July 31, 2013

Thanks for the reply.

I think I figured out what I was doing wrong. After I made a pull request I would finish my branch (before pull request was merged) which would merge my branch back to my local develop branch. Then when I created a new branch and did another pull request it would see that I made a merge with previous branch and tack that on to my new pull request.

I'm still learning so I don't know what the best practice is when doing this.

Currently, when I need to make a new branch, I'll do a pull from origin/develop to my local develop.

Then I will git flow > new feature branch.

Commit/push branch

Pull request branch to be merged with develop

Branch is merged

then I delete my local feature branch.

Everything appears to be working smoothly now that I'm follow the above steps. Does this appear like a correct method of using SourceTree?

cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 1, 2013

Hi Aaron,

I'm not quite sure what you mean 'finish' the branch? Either way, yes doing a pull and making sure your local develop is up to date before creating a new feature branch is the correct thing to do. You can even have multiple feature branches open in parallel, the trick is to branch from origin/develop and not include changes on other un-merged feature branches.

Good luck.

Charles

0 votes
Aaron Shelley August 1, 2013

By 'finish' I meant using Git Flow > Finish Feature.

Thanks for the help.

0 votes
cofarrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2013

Hi Aaron,

I just need to clarify what you mean what you say "containing the previous feature's comits'. In some sense that's exactly what you would expect - when you branch from 'develop' after a merge by definition any new branches will contain the previous feature branches commits. However, after the merge I wouldn't expect to _see_ the commits in the PR 'commits' tab, because they should already exist in the target branch and be ignored.

What is a good practice for pushing new feature branches and closing them out when finished?

After you've merged you shouldn't have to do anything. We tend to tick the 'delete branch' button on the merge dialog because you don't need it any more, but it doesn't matter either way. You would also pull the latest changes down to your local machine (which should include a new merge commit on 'develop')

So my question is, how do I revert the merge of a feature branch to my develop branch after having finished and deleted the feature branch?

You definitely shouldn't need to revert anything.

If you have any screenshots of Stash and/or the commits/branches in question to demonstrate exactly what you mean that would be great.

Cheers,

Charles

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events