Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 614
divyanshm Avatar asked May 07 '13 11:05

divyanshm


People also ask

What is cherry pick in Git?

Git Cherry Pick git cherry-pick is a powerful command that enables arbitrary Git commits to be picked by reference and appended to the current working HEAD. Cherry picking is the act of picking a commit from a branch and applying it to another. git cherry-pick can be useful for undoing changes.

How do I use perforce p4-integ with Git?

The sync command finds new changes in P4 and imports them as Git commits. We name the branch we'll use to directly interface with Perforce p4-integ. At this point we just want to branch it off remotes/p4/main: After the first import has been completed the subsequent git->p4 synchronizations can be done with the following commands:

Is there a way to cherry pick perforce?

Official Perforce cherry picking instructions. JugseR is correct, but keep in mind that Perforce does cherry-picking via merges. You can end up with complicated merge history if you cherry pick often.

Should I use Git or Perforce for version control?

Different teams have different needs. Git version control might be a good choice for one team; Perforce might be the right version control for another. Native, open-source Git can work well. This is especially true for code-only projects with a small group of developers and fast release cycles. One example is website development.


1 Answers

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.

like image 80
JugsteR Avatar answered Sep 18 '22 11:09

JugsteR