Totty.js
Totty.js

Reputation: 15831

How to reuse a branch in git?

What is the best thing to do, or to manage this kind of things in the future? I don't want to lose my branches... I want to keep the history of every step. thanks a lot!

featB            /--\
master --------------X--X--------
featA       \----------/   \-- I want to continue here the featB and not 
                               creating featB2, without losing the history.

Upvotes: 3

Views: 2507

Answers (2)

Totty.js
Totty.js

Reputation: 15831

The question was poorly write too. That was lack of my git knowledge. What I meant it was how to use the same branch name and here is the answer I'm looking for:

  • Merge feat A into the master
  • Delete feat A branch
  • Create the feat A branch again

I didn't know that you could delete a branch or what would happen if was deleted (losing history or so).

From what I currently understand, the branch is just a pointer to some commits. Just to know that commit is not lost somewhere it was given a name (the name of the branch). When you merge a branch into the another the pointer still persist at the commit just before the merge-commit.

I wish I knew it before... but thanks for the comments @jthill

Upvotes: 4

Totty.js
Totty.js

Reputation: 15831

Easy, just figured out: merge the master into the featA and I get featA again.. hope is a good practice

Upvotes: 0

Related Questions