summaryrefslogtreecommitdiff
path: root/checkout.go
diff options
context:
space:
mode:
Diffstat (limited to 'checkout.go')
-rw-r--r--checkout.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/checkout.go b/checkout.go
index 05c2b6a..0331d1d 100644
--- a/checkout.go
+++ b/checkout.go
@@ -27,14 +27,14 @@ func (r *Repo) CheckoutForce() error {
brName := r.GetDevelBranchName()
if r.IsLocalBranch(brName) {
log.Info(r.FullPath, "Checking out local devel")
- if err := r.checkoutBranchErrorUnsafe(brName); err == nil {
+ if err := r.checkoutBranchForceUnsafe(brName); err == nil {
return nil
}
}
if r.IsRemoteBranch(brName) {
log.Info(r.FullPath, "There is a remote devel branch")
// ya, it could run this twice. whatever
- if err := r.checkoutBranchErrorUnsafe(brName); err == nil {
+ if err := r.checkoutBranchForceUnsafe(brName); err == nil {
return nil
}
} else {
@@ -43,14 +43,14 @@ func (r *Repo) CheckoutForce() error {
brName = r.GetMasterBranchName()
if r.IsLocalBranch(brName) {
log.Info(r.FullPath, "Checking out local master")
- if err := r.checkoutBranchErrorUnsafe(brName); err == nil {
+ if err := r.checkoutBranchForceUnsafe(brName); err == nil {
return nil
}
}
if r.IsRemoteBranch(brName) {
log.Info(r.FullPath, "Checking out remote master")
// things are jacked
- if err := r.checkoutBranchErrorUnsafe(brName); err == nil {
+ if err := r.checkoutBranchForceUnsafe(brName); err == nil {
return nil
} else {
return err
@@ -147,8 +147,10 @@ func (repo *Repo) checkoutBranchError(bName string) error {
return nil
}
-func (repo *Repo) checkoutBranchErrorUnsafe(brName string) error {
- cmd := []string{"git", "checkout", brName}
+// force checkout. will delete everyhing. this is bad
+// only do this when you have lost all hope
+func (repo *Repo) checkoutBranchForceUnsafe(brName string) error {
+ cmd := []string{"git", "checkout", brName, "--force"}
var err error
err = repo.RunVerbose(cmd)
if err != nil {