Update my working Git branch from another branch

Suppose you have one release branch and you have created a feature branch from the release branch. Now you want to update your feature branch with release branch. This is a typical case of every developer. Let do it

Branches:
1.release
2.feature

Now we want to update our feature branch with release branch

Step 1:

check the status of your feature branch

git status

If there is anything which need to commit, then first commit then proceed further

Step 2:

If your git status is clean, then you are good to go further. Now you have to checkout your release branch.

git checkout release

Step 3:

After checkout of your release branch, now have to pull all changes of release branch.

git pull

Step 4:

Now have all release branch change in your local, to merge it with your feature branch you need to checkout your feature branch again.

git checkout feature

Step 5:

This is the last step. In this you have to merge release branch changes into feature branch.

git merge release

Now, in your feature branch you have all release branch changes. Now you can push it into your git.

Summary

1. git checkout <your_branch_in_which_you want_to_merge>
2. git checkout <branch_with_which_you_want_to_merge>
3. git pull
4. git checkout <your_branch_in_which_you want_to_merge>
5. git merge <branch_used_in_step_2>

Example

1. git checkout feature
2. git checkout release
3. git pull
4. git checkout feature
5. git merge release

Leave a Reply