Search code examples
gitgit-subtreegit-filter-branch

How to create a git release branch from a directory that is not checked in remote master


I am wondering how to achieve my goal, I want to create a new branch from the master directory, but the directory is autogenerated and it is not checked in.

I want my release branch contains only the final binaries.

Thiis the tree of my master:

$ (master):
        |------>FolderA
        |------>FolderB
        |------>bin  <----- This is autogenerated directory not checkedin

What I want to achieve: new release branch has only bin folder

$(release_branch):
        |------>bin

I tried two methods to do but I'm not able to.

Method 1

I tried to used git subtree:

$git subtree split --prefix=baking/bin/ -b split_libs

No new revisions were found.

I know why I got this error because my autogenerated directory is not checked-in.

Method 2: Split the directory bin into new branch but I wasn't able to do it.

$git filter-branch --prune-empty --subdirectory-filter baking/bin/ test_release

Question: Is it really possible to create a branch from the auto-generated directory which contains only libs?


Solution

  • This is not the real solution, but I just pushed the entire directory in my release branch so that other teams will fetch libraries from bin dir.