git-p4 icon indicating copy to clipboard operation
git-p4 copied to clipboard

How to use git-p4 with multiple branches in Perforce?

Open ludovicc opened this issue 15 years ago • 1 comments

Hello, I would like to use git to be able to switch quickly between branches in Perforce (Main branch, branch for 1.1, branch for 1.2...). Is that possible? I have tried to do:

git clone //Main git-p4 rebase # ok

git-p4 sync //Release/backEnd-1.2/ --branch=1.2 git checkout 1.2 git-p4 rebase Performing incremental import into refs/remotes/p4/master git branch Depot paths: //Main/ No changes to import! fatal: Not a valid object name HEAD~1 Command failed: git cat-file commit HEAD~1

It looks like I'm doing something wrong here.

Thanks, Ludovic

ludovicc avatar Dec 06 '10 18:12 ludovicc

Hey Ludovic,

I was maintaining a fork of the git-p4 script for a while, however the maintainers of the core fixed the issues so I just moved back to using the standard version. (that's the version you download now if you clone this repo).

With respect to your question the quick answer is: no

However I have had a need to work around it. What I ended up doing was to create two git repositories one for each branch. Then I added one as a remote for the other.

Unfortunately when I did the fetch it left me with two roots in the tree. At which point I logged onto IRC and had this conversation:

http://colabti.org/irclogger/irclogger_log/git?date=2010-10-19#l3245

As you can see it's not what you might call easy, but some times your in a bind and you have no choice....

David

dtrott avatar Dec 06 '10 20:12 dtrott