예제 #1
0
// fake     //伪造submodule
// add      //添加伪submodule
// recover  //恢复伪submodule(可能要拉项目)
// status
func init() {
	kmgConsole.AddAction(kmgConsole.Command{
		Name:   "GitSubmoduleCommit",
		Desc:   "git fake submodule Commit",
		Runner: func() { kmgGit.DefaultRepository().MustFakeSubmoduleCommit() },
	})
	kmgConsole.AddAction(kmgConsole.Command{
		Name:   "GitSubmoduleUpdate",
		Desc:   "git fake submodule Update",
		Runner: func() { kmgGit.DefaultRepository().MustFakeSubmoduleUpdate() },
	})
	kmgConsole.AddAction(kmgConsole.Command{
		Name: "GitSmallestChange",
		Runner: func() {
			Local := ""
			Target := ""
			flag.StringVar(&Local, "local", "", "localcommit id (sha256 commit id or branch name or HEAD)")
			flag.StringVar(&Target, "target", "", "targetCommit id (sha256 commit id or branch name or HEAD)")
			flag.Parse()
			if Local == "" || Target == "" {
				flag.Usage()
				return
			}
			result := kmgGit.DefaultRepository().MustSmallestChange(Local, Target)
			fmt.Println(result)
			fmt.Println("#see diff: git diff --stat " + Local + " " + result)
		},
	})
}
예제 #2
0
파일: GitPull.go 프로젝트: keysonZZZ/kmg
func gitPull() {
	flag.Parse()
	remote := flag.Arg(0)
	if remote == "" {
		remote = "origin"
	}
	branchName := kmgGit.DefaultRepository().MustGetCurrentBranchName()
	kmgCmd.ProxyRun("git pull " + remote + " " + branchName)
}
예제 #3
0
파일: GitPush.go 프로젝트: keysonZZZ/kmg
//把当前分支推到origin的当前分支,当前分支不一定是master
func gitPush() {
	flag.Parse()
	remote := flag.Arg(0)
	if remote == "" {
		remote = "origin"
	}
	branchName := kmgGit.DefaultRepository().MustGetCurrentBranchName()
	kmgCmd.MustRunNotExistStatusCheck("git add -A")
	kmgCmd.MustRunNotExistStatusCheck("git commit -am save")
	kmgCmd.MustRunNotExistStatusCheck("git push " + remote + " " + branchName)
}