Skip to content

Commit

Permalink
💡 Re-create branch from latest default branch (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
re-fort authored Feb 4, 2018
1 parent f443d99 commit c8b3227
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const setupHeadFeeder = () => {

repo.fetchAllRemotes()
repo.updateDefaultBranch()
repo.deleteOldBranch(shortHash)
repo.createNewBranch(shortHash)

if (repo.hasConflicts('cherry-pick', hash)) {
Expand Down
4 changes: 4 additions & 0 deletions lib/repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ class Repository {
return Git.exec(`branch -a | grep -c remotes/origin/${branchName}`).stdout.replace('\n', '') === '1'
}

deleteOldBranch(branchName) {
return Git.exec(`branch -D ${branchName}`)
}

createNewBranch(branchName) {
return Git.checkout(branchName, '-b')
}
Expand Down

0 comments on commit c8b3227

Please sign in to comment.