We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f79180b commit 8e3da16Copy full SHA for 8e3da16
main.go
@@ -84,6 +84,15 @@ func run(c config) error {
84
return xerrors.Errorf("unable to get a worktree based on the given fs: %w", err)
85
}
86
87
+ s, err := w.Status()
88
+ if err != nil {
89
+ return xerrors.Errorf("unable to get the working tree status: %w", err)
90
+ }
91
+
92
+ if !s.IsClean() {
93
+ return xerrors.New("the repository is dirty: commit all changes before running 'cob'")
94
95
96
err = w.Reset(&git.ResetOptions{Commit: *prev, Mode: git.HardReset})
97
if err != nil {
98
return xerrors.Errorf("failed to reset the worktree to a previous commit: %w", err)
0 commit comments