1

私はuatgitというタイトルのブランチを持っています。

ブランチで更新さmergeれたすべてのファイルのクローンを取得したいと考えています。(基本的には、uat サーバーにアップロードするビルドを作成するという考え方が背後にあります) . uat

私はこれをやってみました。

#!/bin/bash
branch=$(git symbolic-ref HEAD | sed -e "s/^refs\/heads\///");
if [ "uat" == "$branch" ]; then
    // to do
    // 1. get all updated files
    // 2. create a clone of these files
fi

setp 1つまり、現在のマージですべてのファイルを更新してください。

4

2 に答える 2

1

完全な解決のために。でビルドを作成する方法は次のとおりgit post-merge hookです。

#!/bin/bash

# get current branch    
branch=$(git symbolic-ref HEAD | sed -e "s/^refs\/heads\///");

# check if branch name is `uat` (or whatever you prefer)
if [ "uat" == "$branch" ]; then

    # create a folder outside the git repo
    # you can skip this step, if you want a static location
    mkdir -p $(pwd)/../uat/$(basename $(git root));

    # getting updated files, and
    # copy (and overwrite forcefully) in exact directory structure as in git repo
    yes | cp --parents -rf $(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD) $(pwd)/../uat/$(basename $(git root))/;
fi
于 2015-12-03T10:55:15.267 に答える