代码之家  ›  专栏  ›  技术社区  ›  Git.Coach

发布专用Git存储库的某些路径

  •  5
  • Git.Coach  · 技术社区  · 7 年前

    1. 服务器
    2. 接口

    git-flow develop 在某一点分支。


    使用source并希望授予我们的客户访问这些(子)项目的权限,包括它们的历史记录,同时能够轻松地推送更新并使用gitlab issues

    我的想法:

    1. git submodules 存储库。(如果读过很多关于无效路径问题的文章)
    2. Client Interface ,我可以再加一个新鲜的 remote 分支基本上会使整个想法无效。风险太高了。
    3. 在内部 continuous integration 会以不同的回购方式运行,我们自己的问题也会在那里被跟踪。

    1 回复  |  直到 6 年前
        1
  •  0
  •   Git.Coach    7 年前

    Git Documentation on how to do this

    1. 然后将这些分支拉到一个新的存储库中
    2. 部署

    我们的

    private local repository 以下内容:

    # Assure we are on the latest stable state within our main repo
    git checkout <CURRENT_STATE>
    
    # Create a new deployment branch from HEAD
    git branch <DEPLOYMENT_BRANCH> HEAD
    
    # Enter the new branch
    git checkout <DEPLOYMENT_BRANCH>
    

    [选项1]:

    # Filter every comment outside of this subdirectory (execute from root directory of repo)
    git filter-branch -f --subdirectory-filter <DIRECTORY_PATH> -- <DEPLOYMENT_BRANCH>
    

    ##
    # Force filter-branch using the tree-filter (keeps the 
    # directory-structure) while deleting all files outside    
    # this directory (Check if you are on <DEPLOYMENT_BRANCH>
    # first). Folders are kept, but since Git does not push 
    # empty folders this is no problem
    
    git filter-branch --tree-filter -f \
        'find . -path <DIRECTORY_PATH> -prune -o -type f -print0 | xargs -0 rm -f' \
        --prune-empty HEAD
    

    我们想增加 master .gitignore

    # Take master .gitignore and add it to the branch
    git checkout master -- .gitignore
    

    您还应该更新它以忽略所有其他目录,但是 <DIRECTORY_PATH>

    ##
    # In .gitignore:
    # Ignore everything:
    *
    
    # Except for these directories:
    
    !path/
    !path/*/
    !.gitignore
    

    准备并提交这些更改:

    git add .gitignore
    git commit -m "Add .gitignore"
    

    private local repositories

    ##
    # If you would pull this branch, Git would attempt a merge it into your current HEAD.
    # Do NOT pull! Instead start tracking the remote branch
    
    git checkout --track origin/<DEPLOYMENT_BRANCH>
    

    destination / deployment repository

    # Add remote to local private repo
    git remote add local <PATH/TO/PRIVATE/REPO/.git>
    
    git checkout master
    

    将更改直接合并到主控形状中

    # Pull changes from private repo and allow unrelated histories
    
    git pull local <DEPLOYMENT_BRANCH> --allow-unrelated-histories
    

    # Track branches for more granular control
    git checkout --track local/<DEPLOYMENT_BRANCH>
    

    # Deploy option 1: (For option 2 simply push your tracked branches)
    git push origin master