Add a file to existing changelist

33,280

Solution 1

In general you can use:

p4 reopen -c CLN FILE ...

to move open files into the specified changelist (regardless of whether they were open for edit, add, etc.).

CLN may be default to dissociate the specified files from any numbered changelist.

Solution 2

You can say:

p4 edit -c changelist# file ...

where changelist# refers to the pending changelist.

Share:
33,280

Related videos on Youtube

Aman Deep Gautam
Author by

Aman Deep Gautam

Software developer at Amazon India. Graduated form IIT Hyderabad in 2013 with honors in Computer Science.

Updated on August 17, 2022

Comments

  • Aman Deep Gautam
    Aman Deep Gautam almost 2 years

    I edited few files in my workspace and did p4 change. Then I remembered that I have to make some more edits to additional files(not in the changelist). I opened those files with p4 edit but how to add these files to existing changelist. Is there a way to do it?

    • devnull
      devnull over 10 years
      Since you use the command line, I'd be tempted to say that you p4 help command would show the help for the specified command right away.
  • Daryl Spitzer
    Daryl Spitzer about 9 years
    When I tried this I got: "can't change from default change - use 'reopen'"
  • Aman Deep Gautam
    Aman Deep Gautam over 8 years
    @DarylSpitzer I have not used p4 in a long time but changing the accepted answer as per upvotes and your comment. I am sure at that time it worked for me.
  • jamesdlin
    jamesdlin about 8 years
    @AmanDeepGautam FYI, this answer works but only for files that are open for edit. It won't work for files that were open for other actions.
  • ashleedawg
    ashleedawg over 6 years
    Are you able to provide more information about this answer?
  • Samwise
    Samwise over 6 years
    This works when opening the file for edit (same as @devnull's answer), and most other commands that open the file will accept a similar -c change option. If you have already opened the file (for any arbitrary action) and want to put it in a different changelist after the fact you want to use the reopen command.
  • Alok Prasad
    Alok Prasad almost 4 years
    How moveout the file from Changelist
  • jamesdlin
    jamesdlin almost 4 years
    @AlokPrasad You can use p4 reopen -c default FILE ... to move the specified files out of a specific changelist and into the default, unnamed changelist. I've updated my answer to mention that.
  • Enlico
    Enlico over 2 years
    Maybe p4 has changed since this answer was given, but I get file(s) not opened on this client when a file was not open. p4 open instead of p4 reopen works though.
  • jamesdlin
    jamesdlin over 2 years
    @Enlico Correct, you would need to use p4 open/p4 edit for files not already open. As I stated, you would use p4 reopen to move open files into the specified changelist, which is the scenario described by the original question.
  • Enlico
    Enlico over 2 years
    @jamesdlin, oh, ok I had over-generalised your regardless of whether they were open for edit, add, etc. I thought it included also the not open at all case.