R Down
R Down

Reputation: 2289

Git Interactive Rebase

I have a feature branch that has been a few months in the making. I've continually pulled from upstream/master to keep up-to-date and I've also regularly pushed to origin/feature_branch_name on bitbucket. My feature branch is now ready for a code review. Reviewers want 1 commit with all of my changes. I'm kind of familiar with interactive rebasing, but I'm not sure how to best accomplish this.

Upvotes: 0

Views: 301

Answers (1)

mipadi
mipadi

Reputation: 411390

It might be easier (and faster) to do a squashed merge instead:

$ git checkout -b tmp upstream/master     # Create a tmp branch (to do merging)
$ git merge --squash feature_branch_name  # Merge in feature_branch_name as one commit
$ git checkout feature_branch_name        # Switch to feature branch
$ git reset --hard tmp                    # Set tmp branch as feature_branch_name
$ git branch -d tmp                       # Delete tmp branch
$ git push -f                             # Push changes

Upvotes: 2

Related Questions