File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
pkg/commands/git_commands Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -284,6 +284,11 @@ func (self *RebaseCommands) GitRebaseEditTodo(todosFileContent []byte) error {
284284 return cmdObj .Run ()
285285}
286286
287+ func (self * RebaseCommands ) getHashOfLastCommitMade () (string , error ) {
288+ cmdArgs := NewGitCmd ("rev-parse" ).Arg ("--verify" , "HEAD" ).ToArgv ()
289+ return self .cmd .New (cmdArgs ).RunWithOutput ()
290+ }
291+
287292// AmendTo amends the given commit with whatever files are staged
288293func (self * RebaseCommands ) AmendTo (commits []* models.Commit , commitIndex int ) error {
289294 commit := commits [commitIndex ]
@@ -292,9 +297,7 @@ func (self *RebaseCommands) AmendTo(commits []*models.Commit, commitIndex int) e
292297 return err
293298 }
294299
295- // Get the hash of the commit we just created
296- cmdArgs := NewGitCmd ("rev-parse" ).Arg ("--verify" , "HEAD" ).ToArgv ()
297- fixupHash , err := self .cmd .New (cmdArgs ).RunWithOutput ()
300+ fixupHash , err := self .getHashOfLastCommitMade ()
298301 if err != nil {
299302 return err
300303 }
You can’t perform that action at this time.
0 commit comments