0

I have created three branches. Master, Staging and development. Staging and development branch comes out from master. Now, I want to take out the development branch and change it in such a way that it should come out from staging branch. Basically I need to shift the origin point of branch. Is there any way to do it? Considering there is no code in each branch and considering there is some code in each branch.

Rahul Dolas
  • 145
  • 1
  • 1
  • 8
  • Can you be more explicit? I do not understand "take out" - do you want to merge your development to staging and then from staging to production? – Michael Nov 12 '12 at 20:50

2 Answers2

0

You want to use git-rebase :

git checkout development
git rebase Staging

For more details, the Pro Git e-book is a very clear presentation of git : you can check section 3.6 : rebasing

Check the info section for the git tag on stackoverflow : What is rebasing?

Community
  • 1
  • 1
LeGEC
  • 46,477
  • 5
  • 57
  • 104
0

If you don't have anything committed to any of those branches, it's easy: They all point to the same commit. You don't have to do anything there.

However, if you do have some code in staging and you also have some in dev, and they both started from the same place. If you now want dev to start from the latest changes in staging, all you need to do is

git rebase staging

when you have the dev branch checked out. For a good explanation of the workflow I think you are trying to achieve, have a read of my article here: http://dymitruk.com/blog/2012/02/05/branch-per-feature/

Adam Dymitruk
  • 124,556
  • 26
  • 146
  • 141