I've been using git-p4 to clone parts of a Perforce repo into a git repo. The tree I've checked out has the following Perforce "branch" structure:
repo/releaseA
repo/releaseB
repo/featureA
repo/featureB
I have a bunch of git commits in my local git repo to the featureA directory; however, I'd like to "rebase" those commits onto the featureB directory instead. Is there a way to translate a set of patches/commits that were originally applied to one directory onto another instead?
if you only want to pick one single commit then use,
git cherry-pick <commit-id>
if you want to apply a series of commit starting from
C1
toCx
, then use rebase --ontogit rebase --onto featureB C1 Cx
Yep. If your commits affect only
repo/featureA
this'll be very easy:and you're done.
If your commits change files outside repo/featureA you need to strip those out,
and
before the
git am
. Any patches that didn't affect anything at all inrepo/featureA
you'll have togit am --skip
in that case.