在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:rubenv/grunt-git开源软件地址:https://github.com/rubenv/grunt-git开源编程语言:JavaScript 100.0%开源软件介绍:grunt-git
Getting StartedIf you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: npm install grunt-git --save-dev Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: grunt.loadNpmTasks('grunt-git'); Upgrading from v0.2.xThe Universal optionsThe following options may be applied to any task options.verboseType: Console output from the git task will be piped to the output of the grunt script. Useful for debugging. options.cwdType: Change the current working directory before executing the git call. Useful for performing operations on repositories that are located in subdirectories.
Note: When performing commands that provide files (e.g. gitcommit), it is also necessary to specify the Example:grunt.initConfig({
gitcommit: {
your_target: {
options: {
cwd: "/path/to/repo"
},
files: [
{
src: ["fileone.txt", "filetwo.js"],
expand: true,
cwd: "/path/to/repo"
}
]
}
},
}) The "gitadd" taskAdd file contents to the index Optionsoptions.allType: Update the index not only where the working tree has a file matching but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree. options.forceType: Allow adding otherwise ignored files. Usage Examplesgrunt.initConfig({
gitadd: {
task: {
options: {
force: true
},
files: {
src: ['test.txt']
}
}
},
}); The "gitcommit" taskCommits the working directory. OverviewIn your project's Gruntfile, add a section named grunt.initConfig({
gitcommit: {
your_target: {
options: {
// Target-specific options go here.
},
files: {
// Specify the files you want to commit
}
}
},
}) Each target defines a specific git task that can be run. The different available tasks are listed below. Optionsoptions.messageType: The commit message. options.descriptionType: The commit description. options.allowEmptyType: When options.noVerifyType: When options.noStatusType: When Usage ExamplesCommit options:
grunt.initConfig({
gitcommit: {
task: {
options: {
message: 'Testing',
noVerify: true,
noStatus: false
},
files: {
src: ['test.txt']
}
}
},
}); The "gitrebase" taskRebases the current branch onto another branch Optionsoptions.branch (required)Type: options.theirsType: When true, use the git equivalent of svn's Usage Examplesgrunt.initConfig({
gitrebase: {
task: {
options: {
branch: 'master'
}
}
},
}); The "gittag" taskCreates (or deletes) a git tag. OverviewIn your project's Gruntfile, add a section named grunt.initConfig({
gittag: {
your_target: {
options: {
// Target-specific options go here.
}
}
},
}) Each target defines a specific git task that can be run. The different available tasks are listed below. Optionsoptions.tagType: The name of the tag. E.g.: options.messageType: The tag message (optional). options.removeType: Whether to delete the tag (optional). options.annotatedType: Whether to create an annotated tag (optional). options.forceType: Whether to force to create or update the tag (optional). Usage Examplesgrunt.initConfig({
gittag: {
addtag: {
options: {
tag: '0.0.1',
message: 'Testing'
}
},
deletetag: {
options: {
tag: '0.0.1',
remove: true
}
}
},
}); The "gitcheckout" taskCreates a git branch using checkout -b, or checks out a given branch. OverviewIn your project's Gruntfile, add a section named grunt.initConfig({
gitcheckout: {
your_target: {
options: {
// Target-specific options go here.
}
}
},
}) Each target defines a specific git task that can be run. The different available tasks are listed below. Optionsoptions.branchType: The name of the branch. E.g.: options.createType: Whether the branch should be created (optional). options.forceType: Whether the checkout should be forced in the case of git errors (optional) options.overwriteType: Whether the branch should be overwritten, or created if it doesn't already exist (optional). NOTE: When enabled, this option overwrites the target branch with the current branch. Usage Examplesgrunt.initConfig({
gitcheckout: {
task: {
options: {
branch: 'testing',
create: true
}
}
},
}); The "gitstash" taskStash the changes in a dirty working directory away. OverviewIn your project's Gruntfile, add a section named grunt.initConfig({
gitstash: {
your_target: {
options: {
// Target-specific options go here.
}
}
},
}) Each target defines a specific git task that can be run. The different available tasks are listed below. Optionsoptions.commandType: The stash command to run. E.g.: options.stashType: The stash to apply. E.g.: options.stagedType: Whether the staged changes should be reapplied (optional). Usage Examplesgrunt.initConfig({
gittag: {
stash: {
options: {
create: true
}
},
apply: {
options: {
command: 'apply',
staged: true,
stash: '0'
}
}
},
}); The "gitclone" taskClones a git repo. OverviewIn your project's Gruntfile, add a section named grunt.initConfig({
gitclone: {
your_target: {
options: {
// Target-specific options go here.
}
}
},
}) Each target defines a specific git task that can be run. The different available tasks are listed below. Optionsoptions.bareType: Run git clone with the options.branchType: Clone the repo with a specific branch checked out. (Cannot be used in conjunction with 'bare') options.depthType: Clone the repo with a limited revision history. (Such clones cannot be pushed from or pulled to.) options.repository (required)Type: The path to the repository you want to clone. options.directoryType: Clone the repo into a specific directory instead of the one git decides. options.recursiveType: Pass the --recursive flag to the git clone command. This is equivalent to running git submodule update --init --recursive immediately after the clone is finished. Usage Examplesgrunt.initConfig({
gitclone: {
clone: {
options: |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论