Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I commit only part of a file in Perforce?

How are you doing this task in Perforce ?

like image 427
mt_serg Avatar asked Aug 10 '11 08:08

mt_serg


People also ask

How do I commit partial files?

In the Commit window, select the file you want to partially commit, then select the text you want to commit in the right pane, then right-click on the selection and choose 'Stage selected lines' from the context menu.

How to commit only some changes in git?

To literally commit only those files, even if other changes have been staged, the second example ( git commit [some files] , which implies the --only switch) should be used. The first example ( git add [some files] followed by git commit ) will also commit any other changes which had been staged.

What command is used to stage only some changes in a file?

git add -p is basically "git add partial (or patch)" Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits.

What is p4 submit?

To submit a pending changelist, issue the p4 submit command. When you issue the p4 submit command, a form is displayed, listing the files in the changelist. You can remove files from this list. The files you remove remain open in the default pending changelist until you submit them or revert them.


1 Answers

Yes, you can't do that.

The only thing you can do would be:

  • shelve your file without reverting it
  • open the diff of your file, and remove any other changes that those you want to submit
  • submit the resulting file which contains only the part you wanted to
  • unshelve the shelved version of the file
  • get the latest revision of it, and resolve (P4 should be able to auto-resolve it)

Then you still have the file in checkout, with the other modifications.

like image 96
Benlitz Avatar answered Sep 19 '22 14:09

Benlitz