Skip to content

get organized by moving and managing your repos in the go-lang fashion

License

Notifications You must be signed in to change notification settings

rot26/git-organized

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-organized

Get organized by moving and managing your repos in the go-lang fashion

Installation

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

Usage

Clone the repo into a git-organized directory

$ git go-clone <repo>

Move the current repo to a git-organized directory

$ git go-organize

Examples

Clone a repo

$ 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

Organize a repo

# 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 $_

Valid Characters

In Linux, valid path characters include:

  1. Alphanumeric characters: a-z, A-Z, 0-9
  2. Special characters: ., -, _,
  3. All other characters will be replaced with _

Valid path characters in Windows include:

  1. Alphanumeric characters: a-z, A-Z, 0-9
  2. Special characters: -, _,
  3. All other characters will be replaced with _

Valid git repo names include:

  1. Alphanumeric characters: a-z, A-Z, 0-9
  2. Special characters: -, _

Valid git repo remote URLs include:

  1. Alphanumeric characters: a-z, A-Z, 0-9
  2. Special characters: -, _, /, :, @, .

Examples of valid git remote URLs

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.

Scripts

git-go-clone.sh

  • Purpose: Clone Git repositories.
  • Usage:
    ./git-go-clone.sh [options] <repository-url>
    
  • Options:
    • -f, --flag: Additional options can be specified as needed.

git-go-organize.sh

  • Purpose: Organize cloned Git repositories.
  • Usage:
    ./git-go-organize.sh [options]
    
  • Options:
    • Various options for sorting and managing directories.

Testing

The project includes unit tests for both scripts to ensure functionality and reliability.

Tests

  • 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

Dependencies

  • Ensure that Git is installed on your system.
  • Bash shell is required to run the scripts.

Makefile

The Makefile automates common tasks such as:

  • Running tests
  • Building scripts
  • Cleaning up the project

Examples

  1. To clone a repository:

    ./git-go-clone.sh https://github.com/user/repo.git
    
  2. To organize cloned repositories:

    ./git-go-organize.sh
    

License

This project is licensed under the MIT License. See the LICENSE file for details.

About

get organized by moving and managing your repos in the go-lang fashion

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages