Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to interactively add files in Perforce (equivalent of `git add -p`)

Tags:

git

perforce

Is there something in Perforce that works like git add -p?

I'd like to diff my local file against the depot, and then choose which parts of the diff will end up in the changelist.

(My goal here is to take multiple changes I've made to a file and commit them in two separate changelists, since they're not conceptually related. But you could also use this to not commit debug code but still leave it in locally).

like image 389
Clayton Hughes Avatar asked Jun 02 '17 02:06

Clayton Hughes


2 Answers

No.

You'll need to shelve one set of changes first.

Sorry.

like image 98
Ron Thompson Avatar answered Oct 15 '22 12:10

Ron Thompson


Perforce does not have git's concept of a staging area, so an equivalent of git add -p doesn't really make sense (where do you want the non-added edits to go? Into a shelved change?)

Personally I use git-p4 and to create a git mirror of a Perforce tree, and then I can actually use git add -p. (You alternatively might want to look into Perforce's Git Fusion system.)

like image 38
jamesdlin Avatar answered Oct 15 '22 14:10

jamesdlin