Git repo scheduling issues
At work, the developer uses perforce to share code. I won't say "version control" because we are not allowed to check out the changes until they are ready for regression testing. In order to get my personal changesets under version control, I was given the right to build my own git and initialize the client depot view to force use as a git repository.
However, there are some difficulties with this.
-
The client view lives in a subfolder
~
, (~/p4
), and I want to have~
version control as well as its own separate history. I can't figure out how to keep the history for~
separate from~/p4
without using a submodule. The problem with the submodule is that it looks like I need to make a repository that becomes a submodule and thengit submodule add <repo> <path>
. But you don't need to make a repository of submodules, except~
. There seems to be no safe place to create an initial client depot view with a git p4 clone.(I worked out the assumption that initializing or cloning a repo into a subdirectory of a git repo is not supported. At least I can't find anything authoritative in the nested git repos.)
edit: Just ignore
~/p4
in the repo embedded in~
is enough for me to initialize the nested repo in~/p4
? My __git_ps1 function still thinks that I am in a git repo when I visit an ignored subdirectory of a git repo, so I tend not to think. -
I need a "remote" repository created with git p4 sync as a branch in ~ / p4. We are required to keep all our code in ~ / p4 so that it is not supported. Can I checkout from a "remote" branch that is really a local branch?
-
This is just for convenience, but I thought I might find out something by asking him. For 99% of the project, I just want to start by revisiting chapter p4 as an initialization object. For the other 1%, I would like to suck the entire history of p4 so that I can view it in git. IOW, after I finish initializing it, the initial commit of remotes / p 4 / master will contain:
revision 1 of //depot/prod/Foo/Bar/* revision X of other files in //depot/prod/*, where X is the head revision
and the branch
remotes/p4/master
contains Y commits, where Y is the number of changelists that the file had in//depot/prod/Foo/Bar/*
, with each commit in history corresponding to one of those p4 changelists, and a HEAD similar to p4 head.
Edit: meagar's answer didn't quite work for me.
I got it working ~ and checked out multiple commits. I ignored ~ / p4 and ~ / p4 not in any commit object. =:
[~@ernie02] (master) $ git show HEAD:p4
fatal: Path 'p4' exists on disk, but not in 'HEAD'.
Then I went to ~ / p4 / prod, the branch I want to checkout. But this repo is broken:
[~/p4/prod@ernie02] (master) $ git log
(shows the log for the repo rooted at ~)
[~/p4/prod@ernie02] (master) $ git init
Initialized empty Git repository in ~/p4/prod/.git/
[~/p4/prod@ernie02] (master) $ git log
fatal: bad default revision 'HEAD'
Edit edit: Sorry, I forgot to transfer something ~/p4/prod
. I am trying to run git p4 sync // depot / prod now ...
a source to share
In response to # 1, if you really want to have your entire home directory in a git repository, but have ~ / p4 in a separate repository, just add "p4" .git_ignore
to your home directory, and make another repo in p4:
$ cd ~
$ git init
$ echo "p4" > .git_ignore
$ git add .git_ignore
# add all files/directories except p4
$ git commit
$ cd p4
$ git init
$ git add .
$ git commit
I don't quite understand # 2, but yes, you can checkout from the "remote" repository that is local to your filesystem. As far as "pulling" from local branches, it doesn't pull; pull includes fetch and merge. If you omit the fetch it is just a merge, so you are really talking about a local branch merge.
a source to share