mirror of
https://github.com/kahole/edamagit.git
synced 2024-09-11 07:15:31 +03:00
address pr comments
This commit is contained in:
parent
dc5cd8ddf7
commit
e0faf63d85
@ -239,11 +239,21 @@ async function createNewSpinoff({ repository }: MenuState) {
|
|||||||
// Checkout new branch
|
// Checkout new branch
|
||||||
await gitRun(repository.gitRepository, ['checkout', '-b', newBranchName]);
|
await gitRun(repository.gitRepository, ['checkout', '-b', newBranchName]);
|
||||||
|
|
||||||
if (upstreamBranchCommit && baseCommit !== upstreamBranchCommit) {
|
if (baseCommit && upstreamBranchCommit && baseCommit !== upstreamBranchCommit) {
|
||||||
await gitRun(repository.gitRepository, ['branch', '-f', base, upstreamBranchCommit]);
|
// Find common ancestor of base branch and upstream branch
|
||||||
|
const mergeBase = await repository.gitRepository.getMergeBase(baseCommit, upstreamBranchCommit);
|
||||||
|
|
||||||
|
// Reset the original branch to the common ancestor
|
||||||
|
await gitRun(repository.gitRepository, [
|
||||||
|
'update-ref',
|
||||||
|
'-m',
|
||||||
|
`"reset: moving to ${mergeBase}"`,
|
||||||
|
`refs/heads/${base}`,
|
||||||
|
mergeBase
|
||||||
|
]);
|
||||||
|
|
||||||
window.setStatusBarMessage(
|
window.setStatusBarMessage(
|
||||||
`Branch ${base} was reset to upstream`,
|
`Branch ${base} was reset to ${mergeBase}`,
|
||||||
Constants.StatusMessageDisplayTimeout
|
Constants.StatusMessageDisplayTimeout
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user