The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Pull requests and remote rebase

James Wilson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 5, 2014

I'm sure others must have come across this but couldn't find anything specifically on it:

Suppose i have a master and a feature (based on master, added so i could do a pull request) branch on the remote  i hae locall tracking branches. Before i issue the pull request, i want to rebase my feature branch so that when the merge to the master happens after the review, it will just be a ff merge. Rebasing the local branch is fine but how do i do it on the remote branch? I can just do a push --force on my feature branch but seems to be a bit brute force. Since pull requests force creation of remote branches, this must be a generice issue.

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
TimP
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 Champions.
November 6, 2014

Adding to @Balazs Szakmary's answer, a third option would be to enable the "squash" merge strategy, which is a special type of rebase that squashes the commits on your feature branch into a single commit before applying it to the target branch.

Edit: There's a feature request here requesting a rebase workflow for pull requests, but it is a technically difficult problem to solve in a way that doesn't hurt performance, because a rebase involves re-applying every single commit onto the target branch, whereas a merge only considers the two branch tips and their common ancestor.

0 votes
Balázs Szakmáry
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 Champions.
November 5, 2014

You have two options:

  1. Rebase and force push as you described
  2. Delete the remote branch (if it exists; you can do it from the branches page on the web interface), rebase the local one and push the rebased branch.
TAGS
AUG Leaders

Atlassian Community Events