Reputation: 3
Let's say I've branched a file in perforce and edited it. Now I'd like to discard the branch history and treat the file as a fresh add. What command accomplishes this?
This scenario arises often because my IDE insists on treating a copy as a branch/edit. After making extensive changes to the copied file, it causes confusion to treat it as a branch/edit.
Upvotes: 0
Views: 431
Reputation: 51907
In your IDE:
Then the IDE will do a new in perforce instead of a branch, the above is only a few keybaord presses if you use your IDE keybaord shortcuts.
Upvotes: 0
Reputation: 49156
You can revert the new file and then add it back, without the copy/move.
cp /path/to/new/file /path/to/new/file.bak
g4 revert /path/to/new/file
mv /path/to/new/file.bak /path/to/new/file
g4 add /path/to/new/file
But, the history is there for a reason. If one exists, you might want to keep it - it might be helpful to see the lineage (even if muddled) at some point in the distant future. Consider changing your settings on your IDE.
Upvotes: 0