Go-Mygit Command Line
Command line tools for easy mass configuration of git remote, and github/gites repositories API.
This replaces mygit, implemented in Bash.
Highlight
Following are highlight of some go-mygit
functions.
Push multiple repository
|
|
Set Archived
|
|
Set Private
|
|
Update Description
|
|
Update Topics
|
|
What It Does
These are the reasons “mygit” got created.
- Parallel processing multiple repository, eg. pushing 10 repos at the same time
- Pushing same repo to multiple git servers which are not mirrored
- Set up same set of git remote repeatedly
- Update repository info on git server(api)
What It Does Not
- Replace
git
command. (git
command is required for git function to work.) - Replace Github cli
gh
(go-mygit
only cover very few api in comparison.)
Features
- Configuration File
- remotes
- groups
- secrets
- Selector for git servers
- -g/–group
- -r/–remote
- Base(git) Commands
- clone
- init
- pull
- push
- remote
- add
- list
- remove
- Repository(api)
- list all repo on server
- create repo on server
- get / set
- archived
- description
- private
- public key(get only)
- secret
- topic
- visibility
- delete
- repository
- secret
Limitation
- Current supported git servers
- github
- gitea
- gogs(not tested)
Go Install
|
|
Usage
|
|
Debug
Use -d
for debug output.
Example:
|
|
Selector
go-mygit
allow command applied to groups or remotes through the use of -g/--group
and -r/--remote
. This applies to all commands except remote
and group
mentioned above.
-g/--group
and -r/--remote
must be placed right after mygit
and before any command.
-g/–group
|
|
-r/–remote
|
|
-g/--group
and -r/--remote
can be used at the same time.
|
|
Git Base Commands
init
, push
are git base commands.
init
go-mygit init
will clear all existing remote and add remote base on -g
/-r
selector. If no group nor remote are specified, all configured remotes will be added.
go-mygit init
by default use current directory name as repository name. Repository name can be specified in the format go-mygit init <repository>
. File .go-mygit.json
containing the repository name will be created, which is used by API based commands.
Before go-mygit init
:
|
|
go-mygit init
without selector:
|
|
go-mygit init
with group internal:
|
|
go-mygit init
with repository name:
|
|
push
go-mygit push
base on -g
/-r
selector. If no group nor remote are specified, all configured remotes will be pushed in sequence.
|
|
|
|
go-mygit push
support options --tags
and --all
–tags
If --tags
is used, go-mygit push
will push all tags.
|
|
–all
If --all
is used, mygit push
will push all branches(--all
).
|
|
Configuration
See go-mygit.json.md
Packages Used
Binary
https://github.com/J-Siu/go-mygit/releases
Repository
Contributors
Change Log
- v1.0.0
- Feature complete
- v1.0.1
- Fix repo new endpoint
- v2.0.0
- Command line restructure
- Clean up func name
- Clean up file name
- Fix typos
- v2.0.1
- upgrade go-helper and go-gitapi for bugfix
- v2.1.0
- Add repo name support for all repoGet* commands
- v2.2.0
- Support deletion of github repository action secret
- v2.3.0
- Add repo(dir) name support for init, push, repo new, and all remote* commands
- v2.4.0
- Add global –noskip flag
- Improve commands Use, Short, Long
- Improve repo/dir handling from command line
- lib.GitApiFromRemote() -> Remote.GetGitApi()
- v2.4.1
- Fix
goreleaser
- Fix
- v2.4.2
- Proper go mod path for v2
- v2.5.0
- Add global flag
--no-parallel
, don’t process in parallel--no-title
, don’t print title in output
- Add support for handling
archived
status - Fix exiting on non-git directory
- Fix remote listing not work for current directory
- Fix push to use git directory remotes
- Add global flag
- v2.5.1
- Remove Go workspace file
- v2.6.0
- Detect if no configuration file
- Add git clone
- Add git pull
License
The MIT License (MIT)
Copyright © 2022 John, Sing Dao, Siu john.sd.siu@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.