version-controlperforcebranching-and-merging

Git cherry pick equivalent in Perforce?


My team uses perforce for version control. There have been a lot of additions in the branch that I am currently working on, as compared to the Release branch.
Now, I just fixed a known bug in the released product, and checked in the code change in the branch that I was working on. Is it possible to check in/merge the same change ONLY, with the release branch?

Alternatively, I am just looking to check-in this bug fix in to the release branch, and not any other code changes. From what I searched online, I figured out that git equivalent for this is - git cherry pick. Is there a way to do this in Perforce?


Solution

  • Yes, it is possible. However, for some reason the official perforce instructions have been moved or removed. Could it be that there are other better alternatives. I dont know. It was now many years since I last used P4 so this is not based on personal experience, rather the suggestion below is what the offical perforce answer forum suggested once upon a time

    echo Change A > foo
    p4 add foo
    p4 submit -d "Add foo" foo
    
    p4 integ foo bar
    p4 submit -d "Branch foo" bar
    
    p4 edit foo
    echo Change B >> foo
    p4 submit -d "Update foo" foo
    
    p4 edit foo
    echo Change C >> foo
    p4 submit -d "Update foo again" foo
    
    p4 integ foo#3,#3 bar
    p4 resolve -o
    

    The link below is kept if someone wants to try and find the original page using archive.org or similar service.

    Official Perforce cherry picking instructions.