Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git: getting changes from another branch

Tags:

git

I have a project which uses git and I'd like to start a new branch to add a major new feature.

Under the main branch, I'll continue to add bug fixes and minor features. At regular intervals I'd like to pull the changes from the main branch into my "major new feature" branch. What's the best way to do this?

Eventually, I'll merge the "major new feature" branch into the main branch.

like image 534
FunLovinCoder Avatar asked Jun 26 '10 16:06

FunLovinCoder


People also ask

How do I pull changes from another branch without merging?

Do a checkout from your current branch and pull from another branch. This pulls all the commits from the other branch into the current branch. You can work on all the changes without changes being committed to actual branch. Optionally you can commit and push if these changes needs to be tracked.

How many ways are present in git to integrate changes from one branch into another?

In Git, there are two main ways to integrate changes from one branch into another: the merge and the rebase .


1 Answers

git checkout featurebranch && git rebase master 

As long as you haven't pushed yet, it is better to replay your changes on top of master.

See:

  • git rebase vs. merge
  • git workflow and rebase vs merge questions
like image 171
VonC Avatar answered Sep 22 '22 21:09

VonC