Integrate existing Git Repository with Perforce (P4)

I have browsed through the web, but I cannot find an answer.
What I am trying to do is the following:

  1. I have a git repository which has been used for over 1 year with lots of commits
  2. Due to productization, the code has to be moved into a P4 rep.
  3. However, the codebase (after transport) may change in git as well as P4

Now lets assume that reference branch in git is master

  • What does it mean to fetch from a clone that is not a remote?
  • How to partially stage a file with LibGit2Sharp?
  • Github configuration for school
  • How to set tab size for hunks in “git add -p”?
  • How do revert a local branch back to how it is in github?
  • git - branch alias?
  • What I did is the following:

    1. Copy the latest code from git into P4 and submit it there
    2. Use git-p4 sync –branch=refs/remotes/p4/masterp4 //../ in order to create a new branch in my existing repository
    3. git merge master into masterp4
    4. does not work since a common commit is missing
    5. git-p4 submit, moreover, is not able to work with merge commits anyway

    Another option was rebasing

    1. Start with an empty repository in P4
    2. Use git-p4 sync to create an empty masterp4 branch in git
    3. Rebase master onto masterp4
    4. Rebase masterp4 onto remote/p4/master
    5. Leads to thousands of p4 changelists.

    The main problem is the broken link between the master branch and this masterp4 branch.
    I wondered if there is not an easier solution anyway. Unfortunately, I am a git n00b.

    Thanks for any ideas,


  • How should I structure my git commits?
  • How to check if the revision(commit) exists in a remote Git repository
  • Update local master to remote master from another branch
  • git pull not working
  • Is it possible to create a git hash object outside a git directory?
  • TortoiseGit - Slow Show Log Revision Query
  • One Solution collect form web for “Integrate existing Git Repository with Perforce (P4)”

    I’d go with creating 1000s of Perforce commits, so that history is preserved.

    Git Baby is a git and github fan, let's start git clone.