Search code examples
version-controlperforce

Perforce get latest change CL#


In my perforce workspace, I run these 3 commands:

# 1
p4 changes -m1 ./...
Change 11111111 on 2020/01/01 by abc@def 'Jan 1'

#2
p4 changes -m1
Change 11112222 on 2020/02/01 by abc@def 'Feb 1'

#3
p4 changes -m1 //...
Change 11113333 on 2020/03/01 by abc@def 'Mar 1'

All three commands result in 3 different outputs

How do i interpret the results?

I wanted to know what is the tip of my local workspace (In analogy to HEAD in git) But this seems to be very convoluted in Perforce

Thanks in Advance :)


Solution

  • Firstly if you are interested only with submitted changes (without pending changelists) you could specify -s submitted option to your command line.

    Your local workspace may not include whole repo, just some view of it, defined by workspace mapping.

    If you want to get global head revision you may use:

    p4 changes -m 1 -s submitted
    

    If you want to get head revision of current directory:

    p4 changes -m 1 -s submitted ./...
    

    More you can find out in p4 help changes