Home > Enterprise >  GIT - Replace a branch content with another
GIT - Replace a branch content with another

Time:10-28

I have the following branches in my local git:

-master
-develop
-test

I am adding a new feature, using the test branch, which was created months ago. I need to update its content (replace everything) with the develop branch.

How can I do that?

CodePudding user response:

Go to develop branch

git checkout develop

Remove the test branch

git branch -d test

Create a new branch called test

git checkout -b test

The new branch test will contain all content of develop branch.

CodePudding user response:

In one go, recreate test branch from where dev is, and check it out :

git checkout -B test develop

(doc for the -B option)

CodePudding user response:

If develop is ahead of test, you can merge test into it

  •  Tags:  
  • git
  • Related