「Git」:修訂間差異

出自Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋
Gslin留言 | 貢獻
创建页面,内容为“'''Git'''是一套版本控制系統(VCS)。 == 外部連結 == * {{Official|https://git-scm.com/}} {{en} Category:軟體
 
Gslin留言 | 貢獻
無編輯摘要
第1行: 第1行:
'''Git'''是一套版本控制系統(VCS)。
'''Git'''是一套版本控制系統(VCS)。
== Hook ==
放在<code>~/.git/hooks/pre-rebase</code>:
<syntaxhighlight lang="bash">
#!/bin/bash
# $1: source branch.
# $2: destination branch (empty if it's current branch).
if [[ "$2" = "develop" || ( "$2" = "" && "$(git rev-parse --abbrev-ref HEAD)" = "develop" ) ]]; then
    if [[ "$1" = "origin/develop" ]]; then
        # OK
        exit 0
    fi
    echo "You cannot rebase develop branch from branch other than origin/develop."
    exit 1
fi
</syntaxhighlight>


== 外部連結 ==
== 外部連結 ==

於 2024年12月23日 (一) 08:33 的修訂

Git是一套版本控制系統(VCS)。

Hook

放在~/.git/hooks/pre-rebase

#!/bin/bash

# $1: source branch.
# $2: destination branch (empty if it's current branch).

if [[ "$2" = "develop" || ( "$2" = "" && "$(git rev-parse --abbrev-ref HEAD)" = "develop" ) ]]; then
    if [[ "$1" = "origin/develop" ]]; then
        # OK
        exit 0
    fi

    echo "You cannot rebase develop branch from branch other than origin/develop."
    exit 1
fi

外部連結