Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Perforce equivalent to svn switch

In svn/cvs I often created a local checkout of main/trunk to start working in the code, and then, when real commit branch is ready, switch to it and start commiting the code there.

I am aware Perforce have quite a different workflow, but I wonder if there is any way to perform a switch and have the local code start pointing to a different branch in the remote repository than before.

like image 225
Sam Avatar asked Feb 16 '26 13:02

Sam


1 Answers

Yes. Essentially:

  • Shelve your local changes
  • Update workspace view to point to the other branch
  • Run p4 sync to update your working copy
  • Unshelve your work in progress

Several parts of that are better in the 2011.1 release:

  • There's a new p4 update command that does a fast workspace update for in-place branching
  • If you use streams, you there's a one-step way to move your workspace to a new stream

Perforce has a new P4Sandbox tool out in a limited beta right now. That tool is for private local work, and it does have a p4 switch command that will feel very familiar to you.

like image 136
randy-wandisco Avatar answered Feb 19 '26 19:02

randy-wandisco