commit

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BackCmd = &cobra.Command{
	Use:   "back",
	Short: "ワークツリー・インデックスを復元せずに、1つ前のコミットに移動する.",
	Args:  cobra.MatchAll(cobra.NoArgs, service.CurrentIsNotReadonly()),
	Run: func(cmd *cobra.Command, args []string) {
		git.ResetHeadWithoutWorktreeAndIndex()
		git.ShowStatus()
	},
}
View Source
var CachupCmd = &cobra.Command{
	Use:   "catchup",
	Short: "現在のブランチのコミットをメインラインに移動する.",
	Args:  cobra.MatchAll(cobra.NoArgs, service.CurrentIsNotReadonly()),
	Run: func(cmd *cobra.Command, args []string) {
		mainline := git.GetConfig(domain.FitConfig().Mainline().Name())
		git.RebaseToMainline(mainline)
	},
}
View Source
var CommitCmd = &cobra.Command{
	Use:   "commit",
	Short: "コミットに関する操作.",
}
View Source
var CreateCmd = &cobra.Command{
	Use:   "create <message>",
	Short: "インデックスから新しいコミットを作成し、現在のブランチをそのコミットに移動する.",
	Args:  service.CurrentIsNotReadonly(),
	Run: func(cmd *cobra.Command, args []string) {
		if createFlag.all {
			service.StageChange([]string{":/"})
		}

		if len(args) == 0 {
			git.CommitWithOpenEditor()
		} else {
			git.CommitWithMessage(args[0])
		}
		git.ShowStatus()
	},
}
View Source
var ListCmd = &cobra.Command{
	Use:   "list",
	Short: "コミットを一覧表示する.",
	Args:  cobra.NoArgs,
	Run: func(cmd *cobra.Command, args []string) {
		if listFlag.details == "" {
			git.FetchPrune()

			gitSubCmd := []string{
				"-c",
				"core.pager=less -FRXS",
				"log",
				"--branches",
				"--tags",
				"--remotes",
				"--graph",
				"--abbrev-commit",
				"--decorate=no",
				"--date=format: %Y-%m-%d %H:%I:%S",
				"--format=format: %C(03)%>|(26)%h%C(reset)   %C(bold 1)%d%C(reset) %C(bold 0)%s%C(reset) %>|(140)%C(reset)  %C(04)%ad%C(reset)  %C(green)%<(16,trunc)%an%C(reset)",
			}
			if listFlag.orphan {
				gitSubCmd = append(gitSubCmd, "--reflog")
			}
			if listFlag.stash {
				gitSubCmd = append(gitSubCmd, "--all")
			}
			util.GitCommand(global.RootFlag, gitSubCmd)
		} else {
			gitSubCmd := []string{"show", "--stat", "--summary", "--patch", listFlag.details}
			util.GitCommand(global.RootFlag, gitSubCmd)
		}
	},
}
View Source
var MergeCmd = &cobra.Command{
	Use:   "merge <commit>",
	Short: "指定したブランチを現在のブランチにマージする.",
	Args:  cobra.MatchAll(cobra.ExactArgs(1), service.CurrentIsNotReadonly()),
	Run: func(cmd *cobra.Command, args []string) {
		if git.ExistsUntrackedFiles([]string{":/"}) || git.ExistsWorktreeDiff([]string{":/"}) || git.ExistsIndexDiff([]string{":/"}) {
			message := "インデックス・ワークツリーにファイルの変更があるため、マージを中止しました\n" +
				"※ \"fit stash store\" でファイルの変更をスタッシュに保存するか、\"fit change delete\" でファイルの変更を破棄してください"
			fmt.Fprintln(os.Stderr, message)
			return
		}
		gitSubCmd := []string{"merge", "--no-ff", args[0]}
		util.GitCommand(global.RootFlag, gitSubCmd)
	},
}
View Source
var SwitchCmd = &cobra.Command{
	Use:   "switch <commit>",
	Short: "指定したコミットに読み取り専用で移動し、ワークツリー・インデックスを復元する.",
	Args:  cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		gitSubCmd := append([]string{"switch", "--detach"}, args[0])
		util.GitCommand(global.RootFlag, gitSubCmd)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL