Skip to content

Commit ce44765

Browse files
committed
Reconstruction completed
1 parent b3d26ff commit ce44765

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+371
-943
lines changed

README.md

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,44 @@
1-
# README
1+
# Table of Contents
2+
- [Introduction](#Introduction)
3+
- [Features](#Features)
4+
- [Installation](#Installation)
5+
- [Usage](#Usage)
6+
- [Screenshots](#Screenshots)
7+
- [Contribution](#Contribution)
8+
- [License](#License)
29

3-
## About
10+
## Introduction
11+
git-helper is an open-source software that aims to assist developers in using git more conveniently and efficiently. In some ways, it can also serve as a git GUI, allowing for quick management of multiple git repositories and grouping them for easy organization. When a specific repository is selected, the corresponding repository directory and command line can be quickly opened, and features such as branch and tag management, code committing and merging can be done.
412

5-
This is the official Wails React-TS template.
613

7-
You can configure the project by editing `wails.json`. More information about the project settings can be found
8-
here: https://wails.io/docs/reference/project-config
14+
## Features
915

10-
## Live Development
16+
- Friendly classification of git repositories
17+
- Convenient code committing and merging
18+
- Viewing commit history
19+
- Branch management, including viewing, adding and deleting branches
20+
- Tag management, including viewing, adding and deleting tags
21+
- Switching between preferred color themes
1122

12-
To run in live development mode, run `wails dev` in the project directory. This will run a Vite development
13-
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
14-
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
15-
to this in your browser, and you can call your Go code from devtools.
23+
## Installation
1624

17-
## Building
25+
- Clone the source code and compile it.
26+
- Download the binary file from the release page.
1827

19-
To build a redistributable, production mode package, use `wails build`.
28+
Note: Many features have only been tested on mac os, Although there are no destructive git commands, but this project is currently only provided for learning and research, please do not use it formally.
29+
30+
## Usage
31+
Currently, there is no clone operation, so you can add your git repositories through the menu first. git-helper will record the repository's path and generate a repository alias, which will be placed in the default category. You can subsequently add categories to classify and sort these repositories. When you select a repository, any actions you perform will be executed in that repository's path. Therefore, when you delete the repository in git-helper, it only removes the path and does not make any destructive changes to your original repository.
32+
33+
## Screenshots
34+
35+
![changes](screenshots/change.png)
36+
![history](screenshots/history.png)
37+
![branch](screenshots/branch.png)
38+
![tag](screenshots/tag.png)
39+
40+
## Contribution
41+
Feel free to open issues or pull requests if you have any suggestions or found any bugs.
42+
43+
## License
44+
This project is licensed under the MIT License.

app.go

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ package main
22

33
import (
44
"context"
5-
"fmt"
65
"git-helper/repository"
76
"git-helper/utils"
8-
"github.com/go-git/go-git/v5"
97
"github.com/wailsapp/wails/v2/pkg/menu"
108
"github.com/wailsapp/wails/v2/pkg/menu/keys"
119
"github.com/wailsapp/wails/v2/pkg/runtime"
@@ -15,8 +13,7 @@ import (
1513
// App struct
1614
type App struct {
1715
ctx context.Context
18-
repository *git.Repository
19-
repo *repository.Repository
16+
repository *repository.Repository
2017
dataSaveJson string
2118
}
2219

@@ -28,14 +25,16 @@ func NewApp() *App {
2825
// startup is called when the app starts. The context is saved
2926
// so we can call the runtime methods
3027
func (a *App) startup(ctx context.Context) {
31-
fmt.Println(ctx)
3228
a.ctx = ctx
3329
u, err := user.Current()
3430
if err != nil {
3531
panic(err)
3632
}
3733
a.dataSaveJson = u.HomeDir + "/Git_Helper.json"
3834
}
35+
func (a *App) setRepository(r *repository.Repository) {
36+
a.repository = r
37+
}
3938

4039
// Greet returns a greeting for the given name
4140
func (a *App) menu() *menu.Menu {
@@ -44,7 +43,7 @@ func (a *App) menu() *menu.Menu {
4443
appMenu.Append(menu.EditMenu())
4544

4645
repo := appMenu.AddSubmenu("Repository")
47-
repo.AddText("Add local repository", keys.CmdOrCtrl("a"), func(_ *menu.CallbackData) {
46+
repo.AddText("Add local repository", keys.CmdOrCtrl("r"), func(_ *menu.CallbackData) {
4847
path, err := runtime.OpenDirectoryDialog(a.ctx, runtime.OpenDialogOptions{
4948
Title: "Select Local Git Repository",
5049
})
@@ -54,35 +53,27 @@ func (a *App) menu() *menu.Menu {
5453
id := utils.Sha256(path)
5554
runtime.EventsEmit(a.ctx, "Repository_A", id, path)
5655
})
57-
repo.AddText("Repository manage", keys.CmdOrCtrl(""), func(_ *menu.CallbackData) {
56+
57+
repo.AddText("Repository manage", keys.CmdOrCtrl("m"), func(_ *menu.CallbackData) {
5858
runtime.EventsEmit(a.ctx, "Repository_M")
5959
})
6060

61-
branch := appMenu.AddSubmenu("Branch")
62-
branch.AddText("New Branch", keys.CmdOrCtrl(""), func(_ *menu.CallbackData) {
61+
bt := appMenu.AddSubmenu("Branch&Tag")
6362

64-
})
65-
branch.AddText("Branch manage", keys.CmdOrCtrl(""), func(_ *menu.CallbackData) {
63+
bt.AddText("Branch manage", keys.CmdOrCtrl("b"), func(_ *menu.CallbackData) {
6664
runtime.EventsEmit(a.ctx, "Branch_M")
6765
})
66+
bt.AddText("Tag manage", keys.CmdOrCtrl("t"), func(_ *menu.CallbackData) {
67+
runtime.EventsEmit(a.ctx, "Tag_M")
68+
})
6869

69-
settings := appMenu.AddSubmenu("Settings")
70-
settings.AddText("Theme", keys.CmdOrCtrl("t"), func(_ *menu.CallbackData) {
70+
other := appMenu.AddSubmenu("Other")
71+
other.AddText("Theme", keys.CmdOrCtrl(""), func(_ *menu.CallbackData) {
7172
runtime.EventsEmit(a.ctx, "Settings_Theme")
7273
})
73-
//settings.AddText("Branch", keys.CmdOrCtrl("b"), func(_ *menu.CallbackData) {
74-
//
75-
//})
76-
77-
//other.AddText("About", keys.CmdOrCtrl("a"), func(_ *menu.CallbackData) {
78-
//
79-
//})
80-
//other.AddText("Version", keys.CmdOrCtrl("v"), func(_ *menu.CallbackData) {
81-
//
82-
//})
83-
//other.AddText("Github", keys.CmdOrCtrl("g"), func(_ *menu.CallbackData) {
84-
//
85-
//})
74+
other.AddText("About", keys.CmdOrCtrl(""), func(_ *menu.CallbackData) {
75+
runtime.EventsEmit(a.ctx, "Settings_About")
76+
})
8677

8778
return appMenu
8879
}

build/appicon.png

53.8 KB
Loading

commit.go

Lines changed: 0 additions & 100 deletions
This file was deleted.

common.go

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
package main
22

33
import (
4+
"errors"
45
"git-helper/utils"
56
"github.com/atotto/clipboard"
67
"github.com/wailsapp/wails/v2/pkg/runtime"
78
"io/ioutil"
8-
"strings"
99
)
1010

11-
const TimeLayout = "2006-01-02 15:04:05"
12-
1311
func (a *App) Sha256(s string) string {
1412
return utils.Sha256(s)
1513
}
@@ -43,14 +41,9 @@ func (a *App) ReadJsonFile() (string, error) {
4341
func (a *App) Clipboard(t string) error {
4442
return clipboard.WriteAll(t)
4543
}
46-
47-
func (a *App) RunCmd(cmd string) (string, error) {
48-
path, err := a.RepositoryPath()
49-
if err != nil {
50-
return "", err
44+
func (a *App) IsGitRepository(path string) (bool, error) {
45+
if !utils.IsDir(path + "/.git") {
46+
return false, errors.New("not a git repository")
5147
}
52-
c := strings.Split(cmd, " ")
53-
54-
return utils.RunCmdByPath(path, c[0], c[1:]...)
55-
48+
return true, nil
5649
}

diffWork.go

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)