add some other git examples
This commit is contained in:
parent
64431969ad
commit
45fca69634
@ -36,4 +36,29 @@ func execute(cmdstr string) string {
|
||||
func main() {
|
||||
gitver := execute("git --version")
|
||||
fmt.Println(gitver)
|
||||
|
||||
gcnf := execute("git config -l")
|
||||
|
||||
config := strings.Split(gcnf, "\n")
|
||||
for i, v := range config {
|
||||
entry := strings.Split(v, "=")
|
||||
if len(entry) < 2 {
|
||||
continue
|
||||
}
|
||||
key := entry[0]
|
||||
val := entry[1]
|
||||
fmt.Printf("%d: %s = '%s' \n", i, key, val)
|
||||
}
|
||||
|
||||
glog := execute("git log --oneline")
|
||||
logarray := strings.Split(glog, "\n")
|
||||
for _, v := range logarray {
|
||||
entryarray := strings.SplitN(v, " ", 2)
|
||||
if len(entryarray) < 2 {
|
||||
continue
|
||||
}
|
||||
commitid := entryarray[0]
|
||||
reason := entryarray[1]
|
||||
fmt.Println(commitid, reason)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user