git-p4
git-p4
通过
git-p4
使用
git
的方式操作
p4
仓库
官方文档: https://git-scm.com/docs/git-p4
安装
p4
环境搭建
p4
客户端安装见官网文档 https://www.perforce.com/downloads/helix-command-line-client-p4,略
p4
配置大致如下:
- 设置环境变量(linux 举例)
export P4CLIENT=tl_username_vm1 export P4PASSWD=password export P4PORT=p4d.xxxxxx.com:1666 export P4USER=tl_backned_01
- 设置工作空间、流
p4 client Client: tl_username_vm1 Update: 2021/09/07 17:06:42 Access: 2021/09/07 19:59:20 Owner: tl_backned_01 Host: ubuntu-vm Description: Created by tl_backned_01. Root: /home/username/MainLineWithUGS Options: allwrite clobber nocompress unlocked modtime rmdir SubmitOptions: submitunchanged LineEnd: unix Stream: //Torchlight/MainLineWithUGS View: //Torchlight/MainLineWithUGS/... //tl_username_vm1/...
- 拉取
代码p4
p4 sync //Torchlight/MainLineWithUGS/backend/... p4 sync //Torchlight/MainLineWithUGS/frontend/trunk/Editor/UE_game/Source/... p4 sync //Torchlight/MainLineWithUGS/frontend/trunk/Editor/UE_game/Script/...
git-p4
安装
平台 | 安装 | 默认路径 | 说明 |
---|---|---|---|
windows | 安装 git | C:\Program Files\Git\mingw64\libexec\git-core\git-p4 | python 路径会有问题,把 改成 |
centos7 | yum install git-p4 | /usr/libexec/git-core/git-p4 | |
ubuntu21 | wget https://github.com/git/git/blob/master/git-p4.py -O git-p4 && chmod +x git-p4 sudo mv git-p4 /usr/lib/git-core/ sudo ln -s /usr/bin/python3 /usr/bin/python | /usr/lib/git-core/git-p4 |
git-p4
仓库创建
git-p4
举例说明,例子工作目录为:
角色 | 目录 |
---|---|
p4 | /home/username/MainLineWithUGS |
git | /home/username/git/MainLineWithUGS |
-
代码拉取(略,上面已经介绍了)p4
- 创建对应
仓库git
cd /home/username/git/MainLineWithUGS git p4 clone //Torchlight/MainLineWithUGS/backend/...
git
仓库操作说明
git
在
/home/username/git/MainLineWithUGS
里,正常
git
所有操作,包括创建分支等等
git
仓库代码提交 p4
仓库
git
p4
git p4 rebase
git p4 submit
或者
git p4 rebase
git p4 submit <git branch name>
说明
- 必须先
,把git p4 rebase
远程仓库最新修改同步到p4
仓库git
- 文中
仓库拉好后,不需要动它,均可在p4
仓库,通过git
命令操作git p4