I'm cloning a repo that was first generated by git-p4. git-p4 uses a 'remotes/p4/master' branch that I would like to track. How do I tell git, which is cloning that repo, to track remotes/p4/master as well? That way I would be able to check out "origin/remotes/p4/master" or something.
-
You can adjust the fetching properties to mirror those references as well, although not as part of a standard clone.
So a sequence like:
git clone ~/p4/git/services/info-service.git cd info-service git config --add remote.origin.fetch +refs/remotes/p4/*:refs/remotes/origin/p4/* git fetch originThis will fetch
refs/remotes/p4/release/1.1for example ininfo-service.gitto berefs/remotes/origin/p4/release/1.1in your clone, and you could create a branch based on it withgit checkout -b r1.1-fixes origin/p4/release/1.1Having said all that, in my Perforce replica repos, I create actual branches to mirror all the p4 remote branches, largely to avoid having to go through all the above. It also gives me a chance to fix up the naming from p4 path prefixes to git branch names (so
p4/mainbecomesmaster,p4/release/1.1becomesr1.1etc). I use my own p4-to-git replication, but you could do much the same by looping over the p4 remote refs withgit for-each-refand setting local branches usinggit update-ref.Josh K : Hi araqnid, is your p4->git replication available publicly? I'd like to compare it to git-p4.
0 comments:
Post a Comment