好吧,所以我遇到了問題或者可能不是,我只是不明白。上一次提交Git標籤
我正在做的是試圖提交併推送提交,但也標記它。
我從一飲而盡運行shell命令這樣做,雖然這樣有可能有一些做它,
git add [files]
git commit -m [message]
git tag -a [tag name] [branch] -m [message]
然後
git push origin [tag name]
但問題是該標籤被推送在前一個提交,而不是我目前提交。
我現在的大口的任務是這樣的:
var gulp = require('gulp'),
plugin = require('gulp-load-plugins')({
camelize: true
}),
ghPages = require('gulp-gh-pages'),
run = require('gulp-run'),
prompt = require('gulp-prompt');
module.exports = function() {
console.log('Deployment is running currently, please be patient.');
return gulp.src('modules/**/*')
.pipe(ghPages({
remoteUrl: '[user]@[ip]:[branch]',
branch: '[branch]'
}))
.on('end', function() {
return gulp.src('modules/**/*')
.pipe(prompt.prompt({
type: 'input',
name: 'release',
message: 'Is this a new release? (y/n)',
}, function(res) {
if (res.release == 'y') {
return gulp.src('modules/**/*', {
read: false
})
.pipe(prompt.prompt({
type: 'input',
name: 'releaseNumber',
message: 'What is the new release version number? (e.g. x.x.x)'
}, function(res) {
run('git fetch --all').exec();
run('git tag -a v' + res.releaseNumber + ' [branch] -m "Bump release"').exec();
run('git push origin v' + res.releaseNumber + ' [branch]').exec();
}));
}
}));
});
};
什麼是在控制檯輸出爲:
Deployment is running currently, please be patient.
[16:12:28] [gh-pages (branch)] Cloning repo
[16:12:28] [gh-pages (branch)] Checkout remote branch `branch`
[16:12:28] [gh-pages (branch)] Updating repository
[16:12:29] [gh-pages (branch)] Copying files to repository
[16:12:29] [gh-pages (branch)] Adding 1 files.
[16:12:29] [gh-pages (branch)] Committing "Update 2016-11-09T21:12:18.579Z"
[16:12:29] [gh-pages (branch)] Pushing to remote.
[16:12:30] Finished 'deploy' after 12 s
[16:12:30] Finished 'build' after 15 s
? Is this a new release? (y/n) y
? What is the new release version number? (e.g. x.x.x) 0.0.5
$ git tag -a v0.0.5 branch -m "Bump release"
$ git push origin v0.0.5
To [user]@[ip]:[repo]
* [new tag] v0.0.5 -> v0.0.5
正如你可以從圖片看,標籤ISN不會被放在我目前正在提交的最新的承諾上。它將它添加到以前的提交中。
我也在master
推到另一個[分支]。也許這可能是問題?
'git tag'不會創建提交。 – jthill
沒錯。它創建標籤。提交已經被創建並且被推送到這一行'[16:12:29] [gh-pages(branch)]添加1個文件。 [16:12:29] [gh-pages(branch)]提交「更新2016-11-09T21:12:18.579Z」[16:12:29] [gh-pages(branch)]推向遠程。' –
所以你在推動'詞彙模塊'?這不是創建一個快進合併提交,因此新的哈希?嘗試使用git命令複製它,而不使用您的gulp文件。 – jkulak