Jump to content


How to revert but keep local changes?

revert changelist

  • Please log in to reply
3 replies to this topic

#1 BJS

BJS

    Member

  • Members
  • PipPip
  • 18 posts

Posted 30 March 2020 - 11:17 AM

If I work offline, I can later "reconcile offline work" to have the changes in a new change-list and the files checked-out.

Is there a way to revert this process with perforce, i.e. "delete" a pending change-list but not revert local files?
Essentially I want to return to the state where files are not checked-out but my local code is still different.

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1193 posts

Posted 30 March 2020 - 03:33 PM

You can use the "revert -k" command to revert but keep local changes.

This is not available in P4V unless you add it as a custom tool; it's not a generally recommended workflow because by definition it leaves your workspace in an inconsistent state where you're at risk of losing those local changes (e.g. a force sync will discard them without prompting, whereas local changes to opened files are always preserved unless you explicitly revert).

#3 BJS

BJS

    Member

  • Members
  • PipPip
  • 18 posts

Posted 30 March 2020 - 04:55 PM

Thanks you very much. I know what it is not a recommended workflow and it is only in a specific situation I need this.
Can you (or anybody else) give me a step-by-step on how I would add such a P4 command as a custom tool to P4V?

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 1193 posts

Posted 30 March 2020 - 04:57 PM

https://www.perforce...ons.custom.html

You want "p4" to be the application and "revert -k %D" to be the arguments.

If this is a one-off, though, I wouldn't recommend making it a custom tool.  Just go to the command line and run the command this one time; that's easier than setting up a tool that you're only going to run once.  :)





Also tagged with one or more of these keywords: revert, changelist

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users