我想确保推送分支上的所有提交消息都具有时间日志
即。 add readme /spend 5m
我想在bitbucket管道中的两个git分支之间获取提交差异,
这是我的yaml管道配置:
pipelines:
default:
- step:
script:
- git log $BITBUCKET_BRANCH --oneline --not master
Run Code Online (Sandbox Code Playgroud)
$ BITBUCKET_BRANCH是管道正在作用的分支。
但是管道尝试与主管道比较时返回错误
+ git log $BITBUCKET_BRANCH --oneline --not master
fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Run Code Online (Sandbox Code Playgroud)
请注意,管道中的设置步骤(这是由bitbucket预定义的,我无法更改)
git clone --branch="abdullah-s/bitbucketpipelinesyml-created-online-wit-1489917130851" --depth 50 https://x-token-auth:$REPOSITORY_OAUTH_ACCESS_TOKEN@bitbucket.org/abdullah-s/webook.git $BUILD_DIR;
git reset --hard ac61f080a28428bdd885735374164577a2b0aa43;
git remote set-url origin git@bitbucket.org:abdullah-s/webook.git
Run Code Online (Sandbox Code Playgroud)
在设置的第一个命令中,bitbucket从我的存储库中仅克隆了一个分支
我试图拉大师
- git checkout -b master
- git pull origin master
- git log $BITBUCKET_BRANCH --oneline --not master
Run Code Online (Sandbox Code Playgroud)
但是有一个错误
+ git pull origin master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)
正如您正确指出的那样,Bitbucket管道将仅克隆触发构建的特定分支。
这样,RefSpec将被设置为特定的分支,并且您将无法合并或区分其他分支。
例如,如果在develop分支上触发了构建,则将设置以下refspec:
[remote "origin"]
url = git@bitbucket.org:xxxxxx
fetch = +refs/heads/develop:refs/remotes/origin/develop
[branch "develop"]
remote = origin
merge = refs/heads/develop
Run Code Online (Sandbox Code Playgroud)
如果您查看可用的分支,您将看到:
+ git branch -a
* develop
remotes/origin/develop
Run Code Online (Sandbox Code Playgroud)
您可以执行以下命令:
git fetch origin "+refs/heads/*:refs/remotes/origin/*"
Run Code Online (Sandbox Code Playgroud)
拉入所有其他分支/标签
From bitbucket.org:xxxx/xxxxx
* [new branch] master -> origin/master
* [new branch] release -> origin/release
* [new tag] xxxx -> xxxx
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2333 次 |
| 最近记录: |