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配置大致如下:

  1. 设置环境变量(linux 举例)

    export P4CLIENT=tl_username_vm1
    export P4PASSWD=password
    export P4PORT=p4d.xxxxxx.com:1666
    export P4USER=tl_backned_01
    
  2. 设置工作空间、流

    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/...
    
  3. 拉取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安装 gitC:\Program Files\Git\mingw64\libexec\git-core\git-p4python 路径会有问题,把 #!/usr/bin/python2 改成#!/usr/bin/env python
centos7curl -o git-p4 https://raw.githubusercontent.com/git/git/master/git-p4.py
sed -i ‘s%#!/usr/bin/env python%#!/usr/bin/env python3%g’ git-p4
chmod +x git-p4
sudo mv git-p4 /usr/libexec/git-core/
/usr/libexec/git-core/git-p4
ubuntu21curl -o git-p4 https://raw.githubusercontent.com/git/git/master/git-p4.py
sed -i ‘s%#!/usr/bin/env python%#!/usr/bin/env python3%g’ git-p4
chmod +x git-p4
sudo mv git-p4 /usr/lib/git-core/
/usr/lib/git-core/git-p4

git-p4仓库创建

举例说明,例子工作目录为:

角色目录
p4/home/username/MainLineWithUGS
git/home/username/git/MainLineWithUGS
  1. p4代码拉取(略,上面已经介绍了)
  2. 创建对应git仓库
    cd /home/username/git/MainLineWithUGS
    git p4 clone //Torchlight/MainLineWithUGS/backend/...
    

git仓库操作说明

/home/username/git/MainLineWithUGS里,正常git所有操作,包括创建分支等等

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命令操作
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

fananchong2

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值