I had been using Perforce for revision control mostly for Windows and binary files (excel, PDF, etc.). It worked amazingly well and had a powerful GUI! However I finally decided to consolidate on Git.
Primary instructions are from git scm
In CentOS you will need the helper package:
$ sudo yum install git-p4
The following steps worked perfectly for me.
- My Git projects are in ~/git (where the converted project will end up)
- My Perforce server is on atlas
- I use ~/work as my working directory (where I clone, checkout, etc.)
[mirandam@atlas ~]$ mkdir ~/git/p4proj
[mirandam@atlas ~]$ cd ~/git/p4proj
[mirandam@atlas p4proj]$ git init --bare
[mirandam@atlas p4proj]$ cd ~/work
[mirandam@atlas work]$ export P4PORT=atlas:1666
[mirandam@atlas work]$ p4 login
User mirandam logged in.
[mirandam@atlas work]$ git p4 clone //depot@all p4proj
Importing from //depot@all into p4proj
Reinitialized existing Git repository in /home/mirandam/work/p4proj/.git/
Import destination: refs/remotes/p4/master
Importing revision 189 (100%)
[mirandam@atlas work]$ cd p4proj
[mirandam@atlas p4proj]$ git remote add origin ~/git/p4proj
[mirandam@atlas p4proj]$ git push origin master
Counting objects: 2268, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (770/770), done.
Writing objects: 100% (2268/2268), 159.98 MiB | 128.79 MiB/s, done.
Total 2268 (delta 1272), reused 2268 (delta 1272)
* [new branch] master -> master
Now in my work directory I can perform changes and continue working.