How can I delete a feature branch (or any branch) in Perforce?

I'm a Perforce newbie and I'm just starting to get familiar with the Perforce branching functionality. One thing I don't understand is how to delete a feature branch after I've finished working with it and the changes have been merged back into the mainline branch, just like you would with a feature branch in Git.

Can you delete branches in perforce or do they stay permanently in Perforce?

+3


source to share


2 answers


If this is a task flow (which is what I would recommend for a short-lived stream of function types), you probably want to "offload" it:

p4 unload -s //depot/task_stream

      

It's basically like deleting a stream with "p4 stream -d", except you can bring it back later if you like. As with "p4 stream -d", it also does not get rid of all files in the stream; the ones you changed remain in the depot (so you can keep track of the merge records back to the original if you like), but all unmodified files are uploaded (whereas with "stream -d" they are gone and there is not any convenient record of what exact version they are matching in the parent - you can restore it after the fact, but this is trickier). Using "p4 reload" returns awaiting task flow.

If this is a regular stream and / or you want to get rid of it permanently, including the original changes in its depot path, you need to be an administrator (changes presented in Perforce are usually considered very important and unchanged unless you are an administrator) and use the "kill" command and then remove the stream spec:



p4 obliterate -y //depot/your_stream/...
p4 stream -d //depot/your_stream

      

Given your description, I definitely recommend using task flows for functions and "unloading" them when you're done.

If you're not using threads at all, the standard practice with branches is to either just leave them when you're done with them, or reuse them (i.e. have a current development branch that you merge into mainline as you do each function). You can destroy the branch (as described above in the example stream), but since this requires admin permissions, this is not typical.

+3


source


Using command-line tools p4 branch -d BranchName

. Or are you using Streams?



0


source







All Articles