Get organized by moving and managing your repos in the go-lang fashion
Curl the script into your path
curl -s https://raw.githubusercontent.com/rot26/git-organized/refs/heads/master/src/git-go-clone -o /usr/local/bin/git-go-clone && chmod u x /usr/local/bin/git-go-clone
curl -s https://raw.githubusercontent.com/rot26/git-organized/refs/heads/master/src/git-go-organize.sh -o /usr/local/bin/git-go-organize && chmod u x /usr/local/bin/git-go-organize
Clone the repo into a git-organized directory
$ git go-clone <repo>
Move the current repo to a git-organized directory
$ git go-organize
$ git go-clone https://github.com/rot26/git-organized.git
# Is the same as
$ git clone https://github.com/rot26/git-organized.git ${GOPATH:-HOME}/src/github.com/rot26/git-organized
# At old path
$ git go-organize /random/path/to/repo
# Is the same as
$ mv /random/path/to/repo ${GOPATH:-HOME}/src/github.com/rot26/git-organized && cd $_
In Linux, valid path characters include:
- Alphanumeric characters:
a-z
,A-Z
,0-9
- Special characters:
.
,-
,_
, - All other characters will be replaced with
_
Valid path characters in Windows include:
- Alphanumeric characters:
a-z
,A-Z
,0-9
- Special characters:
-
,_
, - All other characters will be replaced with
_
Valid git repo names include:
- Alphanumeric characters:
a-z
,A-Z
,0-9
- Special characters:
-
,_
Valid git repo remote URLs include:
- Alphanumeric characters:
a-z
,A-Z
,0-9
- Special characters:
-
,_
,/
,:
,@
,.
Service | URL Examples | Linux PATH Examples |
---|---|---|
GitHub | https://github.com/user/repo.git |
github.com/user/repo |
ssh://[email protected]:user/repo.git |
github.com/user/repo |
|
git://github.com/user/repo.git |
github.com/user/repo |
|
[email protected]:user/repo.git |
github.com/user/repo |
|
https://github.com/org/repo.git |
github.com/org/repo |
|
ssh://[email protected]:org/repo.git |
github.com/org/repo |
|
[email protected]:org/repo.git |
github.com/org/repo |
|
Bitbucket | https://bitbucket.org/user/repo.git |
bitbucket.org/user/repo |
ssh://[email protected]:user/repo.git |
bitbucket.org/user/repo |
|
[email protected]/user/repo.git |
bitbucket.org/user/repo |
|
https://bitbucket.org/org/repo.git |
bitbucket.org/org/repo |
|
ssh://[email protected]:org/repo.git |
bitbucket.org/org/repo |
|
[email protected]:org/repo.git |
bitbucket.org/org/repo |
|
GitLab | https://gitlab.com/user/repo.git |
gitlab.com/user/repo |
ssh://[email protected]:user/repo.git |
gitlab.com/user/repo |
|
[email protected]:user/repo.git |
gitlab.com/user/repo |
|
https://gitlab.com/org/repo.git |
gitlab.com/org/repo |
|
ssh://[email protected]:org/repo.git |
gitlab.com/org/repo |
|
[email protected]:org/repo.git |
gitlab.com/org/repo |
|
Other Git Hosting | https://gitea.com/user/repo.git |
gitea.com/user/repo |
Services | ssh://[email protected]:user/repo.git |
gitea.com/user/repo |
[email protected]:user/repo.git |
gitea.com/user/repo |
|
https://sourcehut.org/user/repo.git |
sourcehut.org/user/repo |
|
ssh://[email protected]:user/repo.git |
sourcehut.org/user/repo |
|
[email protected]:user/repo.git |
sourcehut.org/user/repo |
|
Custom Git Servers | https://git.example.com/user/repo.git |
git.example.com/user/repo |
ssh://[email protected]:2222/user/repo.git |
git.example.com/user/repo |
|
[email protected]:user/repo.git |
git.example.com/user/repo |
|
https://git.example.com/org/repo.git |
git.example.com/org/repo |
|
ssh://[email protected]:2222/org/repo.git |
git.example.com/org/repo |
|
[email protected]:org/repo.git |
git.example.com/org/repo |
|
https://git.example.com:8443/user/repo.git |
git.example.com/user/repo |
|
ssh://[email protected]:8443/user/repo.git |
git.example.com/user/repo |
|
[email protected]:8443/user/repo.git |
git.example.com/user/repo |
|
https://git.example.com:8443/org/repo.git |
git.example.com/org/repo |
|
ssh://[email protected]:8443/org/repo.git |
git.example.com/org/repo |
|
[email protected]:8443/org/repo.git |
git.example.com/org/repo |
This project provides two main scripts for managing Git repositories: git-go-clone
for cloning repositories and git-go-organize
for organizing cloned repositories.
- Purpose: Clone Git repositories.
- Usage:
./git-go-clone.sh [options] <repository-url>
- Options:
-f
,--flag
: Additional options can be specified as needed.
- Purpose: Organize cloned Git repositories.
- Usage:
./git-go-organize.sh [options]
- Options:
- Various options for sorting and managing directories.
The project includes unit tests for both scripts to ensure functionality and reliability.
-
test_git-go-clone.sh
: Tests for cloning functionality, including:- Successful cloning
- Handling invalid URLs
- Checking for existing directories
-
test_git-go-organize.sh
: Tests for organizing functionality, including:- Correct sorting of repositories
- Management of directories
- Ensure that Git is installed on your system.
- Bash shell is required to run the scripts.
The Makefile automates common tasks such as:
- Running tests
- Building scripts
- Cleaning up the project
-
To clone a repository:
./git-go-clone.sh https://github.com/user/repo.git
-
To organize cloned repositories:
./git-go-organize.sh
This project is licensed under the MIT License. See the LICENSE file for details.