mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 16:38:50 +02:00
git checkout - working
This commit is contained in:
parent
c523d3735a
commit
6cf842c2f6
3 changed files with 30 additions and 3 deletions
|
@ -295,7 +295,8 @@ OptionParser.prototype.getMasterOptionMap = function() {
|
||||||
},
|
},
|
||||||
checkout: {
|
checkout: {
|
||||||
'-b': false,
|
'-b': false,
|
||||||
'-B': false
|
'-B': false,
|
||||||
|
'-': false
|
||||||
},
|
},
|
||||||
reset: {
|
reset: {
|
||||||
'--hard': false,
|
'--hard': false,
|
||||||
|
|
27
src/git.js
27
src/git.js
|
@ -1132,6 +1132,18 @@ GitEngine.prototype.checkoutStarter = function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.commandOptions['-']) {
|
||||||
|
// get the heads last location
|
||||||
|
var lastPlace = this.HEAD.get('lastLastTarget');
|
||||||
|
if (!lastPlace) {
|
||||||
|
throw new GitError({
|
||||||
|
msg: 'Need a previous location to do - switching'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.HEAD.set('target', lastPlace);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.commandOptions['-B']) {
|
if (this.commandOptions['-B']) {
|
||||||
var args = this.commandOptions['-B'];
|
var args = this.commandOptions['-B'];
|
||||||
this.twoArgsImpliedHead(args, '-B');
|
this.twoArgsImpliedHead(args, '-B');
|
||||||
|
@ -1438,6 +1450,21 @@ var Ref = Backbone.Model.extend({
|
||||||
throw new Error('must be given an id');
|
throw new Error('must be given an id');
|
||||||
}
|
}
|
||||||
this.set('type', 'general ref');
|
this.set('type', 'general ref');
|
||||||
|
|
||||||
|
if (this.get('id') == 'HEAD') {
|
||||||
|
this.set('lastLastTarget', null);
|
||||||
|
this.set('lastTarget', this.get('target'));
|
||||||
|
// have HEAD remember where it is for checkout -
|
||||||
|
this.on('change:target', this.targetChanged, this);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
targetChanged: function(model, targetValue, ev) {
|
||||||
|
// push our little 3 stack back. we need to do this because
|
||||||
|
// backbone doesn't give you what the value WAS, only what it was changed
|
||||||
|
// TO
|
||||||
|
this.set('lastLastTarget', this.get('lastTarget'));
|
||||||
|
this.set('lastTarget', targetValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
toString: function() {
|
toString: function() {
|
||||||
|
|
1
todo.txt
1
todo.txt
|
@ -11,7 +11,6 @@ Big things:
|
||||||
Medium things:
|
Medium things:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
- gitEngine loads from tree immediately, not the weird thing we have now!
|
- gitEngine loads from tree immediately, not the weird thing we have now!
|
||||||
- help better
|
|
||||||
|
|
||||||
Small things to implement:
|
Small things to implement:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue