-1

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?

8
  • Do you mean that you want to effectively discard the current test branch and create it new with the same state as develop?
    – mkrieger1
    Commented Oct 27, 2021 at 12:13
  • @mkrieger1 exactly
    – Raul
    Commented Oct 27, 2021 at 12:14
  • Try with git pull origin develop from you test branch
    – Dinesh s
    Commented Oct 27, 2021 at 12:15
  • @mkrieger1 it is already created with no up-to-date content. I want to replace its state with the develop state.
    – Raul
    Commented Oct 27, 2021 at 12:15
  • 1
    @RAZAFINARIVOHanania yeah but if develop is ahead of test i think it will replace whole branch?
    – Dinesh s
    Commented Oct 27, 2021 at 12:23

2 Answers 2

2

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

git checkout -B test develop

(doc for the -B option)

1

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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.