mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 08:50:06 +02:00
Add git switch -C
This commit is contained in:
parent
2edc86e9a0
commit
86bf7c7a71
2 changed files with 33 additions and 2 deletions
|
@ -924,6 +924,7 @@ var commandConfig = {
|
|||
options: [
|
||||
'-c',
|
||||
'--create',
|
||||
'-C',
|
||||
'-'
|
||||
],
|
||||
execute: function(engine, command) {
|
||||
|
@ -935,16 +936,30 @@ var commandConfig = {
|
|||
if (createOption) {
|
||||
// the user is really trying to just make a
|
||||
// branch and then switch to it. so first:
|
||||
var args = createOption.concat(generalArgs)
|
||||
let args = createOption.concat(generalArgs)
|
||||
command.twoArgsImpliedHead(args, '-c');
|
||||
|
||||
var validId = engine.validateBranchName(args[0]);
|
||||
let validId = engine.validateBranchName(args[0]);
|
||||
engine.branch(validId, args[1]);
|
||||
engine.checkout(validId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let fc = '-C';
|
||||
let fcOption = commandOptions[fc];
|
||||
if (fcOption) {
|
||||
let args = fcOption.concat(generalArgs);
|
||||
command.twoArgsImpliedHead(args, fc);
|
||||
|
||||
let validId = engine.validateBranchName(args[0]);
|
||||
engine.forceBranch(validId, args[1]);
|
||||
engine.checkout(validId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (commandOptions['-']) {
|
||||
// get the heads last location
|
||||
var lastPlace = engine.HEAD.get('lastLastTarget');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue