mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 00:40:07 +02:00
nice rebase update
This commit is contained in:
parent
4e757b7189
commit
93abdd9043
2 changed files with 22 additions and 14 deletions
18
src/git.js
18
src/git.js
|
@ -721,12 +721,6 @@ GitEngine.prototype.rebaseStarter = function() {
|
||||||
|
|
||||||
if (this.generalArgs.length == 1) {
|
if (this.generalArgs.length == 1) {
|
||||||
this.generalArgs.push('HEAD');
|
this.generalArgs.push('HEAD');
|
||||||
if (this.getDetachedHead()) {
|
|
||||||
throw new GitError({
|
|
||||||
msg: "No rebasing in detached head when you are " +
|
|
||||||
"referring to HEAD by only passing in one argument!"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var response = this.rebase(this.generalArgs[0], this.generalArgs[1]);
|
var response = this.rebase(this.generalArgs[0], this.generalArgs[1]);
|
||||||
|
@ -754,6 +748,7 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
msg: 'Branch already up-to-date'
|
msg: 'Branch already up-to-date'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isUpstreamOf(currentLocation, targetSource)) {
|
if (this.isUpstreamOf(currentLocation, targetSource)) {
|
||||||
// just set the target of this current location to the source
|
// just set the target of this current location to the source
|
||||||
this.setLocationTarget(currentLocation, this.getCommitFromRef(targetSource));
|
this.setLocationTarget(currentLocation, this.getCommitFromRef(targetSource));
|
||||||
|
@ -790,7 +785,7 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
toRebaseRough.push(popped);
|
toRebaseRough.push(popped);
|
||||||
// keep searching
|
// keep searching
|
||||||
pQueue = pQueue.concat(popped.get('parents'));
|
pQueue = pQueue.concat(popped.get('parents'));
|
||||||
pQueue.sort(this.idSortFunc);
|
// pQueue.sort(this.idSortFunc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// now we have the all the commits between currentLocation and the set of target.
|
// now we have the all the commits between currentLocation and the set of target.
|
||||||
|
@ -827,8 +822,8 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// now sort
|
// now reverse it once more to get it in the right order
|
||||||
toRebase.sort(this.idSortFunc);
|
toRebase.reverse();
|
||||||
animationResponse.toRebaseArray = toRebase.slice(0);
|
animationResponse.toRebaseArray = toRebase.slice(0);
|
||||||
|
|
||||||
// now pop all of these commits onto targetLocation
|
// now pop all of these commits onto targetLocation
|
||||||
|
@ -858,11 +853,6 @@ GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
// now we just need to update where we are
|
// now we just need to update where we are
|
||||||
this.setLocationTarget(currentLocation, base);
|
this.setLocationTarget(currentLocation, base);
|
||||||
|
|
||||||
// if we are in detached head, update that too
|
|
||||||
if (this.getDetachedHead()) {
|
|
||||||
this.setLocationTarget(this.HEAD, base);
|
|
||||||
}
|
|
||||||
|
|
||||||
// for animation
|
// for animation
|
||||||
return animationResponse;
|
return animationResponse;
|
||||||
};
|
};
|
||||||
|
|
18
todo.txt
18
todo.txt
|
@ -21,3 +21,21 @@ Minor Bugs to fix:
|
||||||
Big Bugs to fix:
|
Big Bugs to fix:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
|
eah forces moving it to the commit you indicate
|
||||||
|
which is impossible as far as I can tell, short of detaching, deleting the branch, and doing branch [name] [commit]
|
||||||
|
(detach in case that's the branch you're currently on)
|
||||||
|
checkout -B [name] [commit] is equivalent to branch -f [name] [commit] and then checkout [name]
|
||||||
|
tl;dr "branch" is to "checkout -b" as "branch -f" is to "checkout -B"
|
||||||
|
|
||||||
|
seems like "branch -f [name] [commit]" does the following:
|
||||||
|
git checkout --detach # in case you're on [name]
|
||||||
|
git branch -D [name] # delete
|
||||||
|
git branch [name] [commit] # move to given commit
|
||||||
|
git checkout [name] # switch back
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue