On Wed, 23 Mar 2016 09:04:45 -0700 (PDT)
frederic_dumou...@yahoo.fr wrote:

> I'd like to know if it's possible to re-use a branch name after it
> has been merged into master.
> Here are the details of what I did :
> * creation of a personnal branch
>   git checkout -b fdn/myBranch
> * regular work with commits and push in fdn/myBranch
> * report work into master
>   git checkout master
>   git pull origin master
>   git checkout fdn/myBranch
>   git rebase master
>   git checkout master
>   git merge --no-ff fdn/myBranch
> I have new things to add in the project, do I have to create a new
> branch or is there any way to re-use fdn/myBranch ?

Broadly speaking, yes.
But what exactly to do about it depends on how do you define "re-use".

If you intend to *continue* working on fdn/myBranch -- to add there
work which logically follows what's already there (and has been
integrated into "master" as well), -- then just do that: you will be
able to merge to "master" again any number of times.

If you intend to truly "re-use" the branch name in that its name is
used for some work unrelated to what's currently on the branch then
just reset that branch to a commit you want it to point at.

Say, you now want to "re-fork" your fdn/myBranch off a branch
"feauture"; then do this:

  git checkout -B fdn/myBranch feature

and do the work.  Note that if you have pushed your branch to some
remote "central" (backup or otherwise) repository, you'll need to
force-push it the next time (use the "-f" command-line option when
calling `git push`) because this branch now contains the history
unrelated to its replica created/updated by former pushes.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to