Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do a Git Rebase in Sourcetree?

I want my local master branch to include the commit 'fixed js errors' and be rebased into origin/master.
enter image description here

I started the process like this: enter image description here

Which leads me to this: my Sourcetree

But as you can see, I'm asked to pull before I push. And every time I pull I end up with a situation depicted in the first image. What am I doing wrong?! Thanks,

like image 678
shicholas Avatar asked Apr 05 '13 18:04

shicholas


People also ask

What is rebase in Sourcetree?

The Rebase Option This moves the entire feature branch to begin on the tip of the main branch, effectively incorporating all of the new commits in main . But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch.

How do I rebase a git repository?

To rebase, make sure you have all the commits you want in the rebase in your master branch. Check out the branch you want to rebase and type git rebase master (where master is the branch you want to rebase on).

What is git rebase with example?

It is used to apply a sequence of commits from distinct branches into a final commit. It is an alternative of git merge command. It is a linear process of merging. In Git, the term rebase is referred to as the process of moving or combining a sequence of commits to a new base commit.


1 Answers

Your original structure would not support rebasing. Let's say you had a commit to your local master and someone else had committed (and pushed) another change to origin/master. In this scenario, you could rebase your commit on top of the other commits.

Your scenario has a commit from a completely different branch. You would either need to merge your other branch into master, or you could cherry pick that one commit and apply to the master branch.

like image 100
CodeNaked Avatar answered Sep 26 '22 19:09

CodeNaked