#version #git-repository #fetch #remote #increment #github #file

app gitSource

Git CLI tool to update the server with the latest code

1 unstable release

0.0.1 Oct 3, 2024

#19 in #increment

MIT license

21KB
352 lines

GitSource

GitSource is a Rust CLI tool designed to manage versioning and synchronization of Git repositories. The tool automates fetching and updating Git repositories, comparing version information, and more.

Features

  • init: Initializes a gitSource.json file that contains information about the Git repository, including username, repo name, branch, and version. If the file already exists, it will skip the initialization.
  • update: Increments the version number by updating the patch version (e.g., from 0.0.1 to 0.0.2).
  • update-major: Increments the major version number (e.g., from 0.7.2 to 1.0.0).
  • fetch: Compares the local version with the remote version fetched from GitHub, and runs git fetch if the remote version is newer.

Quick Install

cargo install gitSource@0.0.1

Usage

1. Initialize gitSource.json

Use the init subcommand to create a gitSource.json file. If the file already exists, it won't prompt for input.

gs init

2. Update Version

Use the update subcommand to increment the patch version:

gs update

For example, this will change the version from 0.0.1 to 0.0.2.

3. Update Major Version

Use the update-major subcommand to increment the major version:

gs update-major

For example, this will change the version from 0.7.2 to 1.0.0.

4. Fetch Remote Version

Use the fetch subcommand to compare the local version with the remote version. If the remote version is newer, it will automatically fetch the updates:

gs fetch

Installation

To install GitSource, follow these steps:

  1. Install rust:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

  1. Verify that rust and cargo is installed by running:
rustc --version
cargo --version
  1. Run the installation script:
cargo install gitSource@0.0.1
  1. Use the cli:
gs [argument]

If you wish to manually build the program:

  1. Clone the repository:
git clone https://github.com/yourusername/gitsource.git
  1. Navigate to the project directory:
cd gitsource
  1. Build the project:
cargo build --release
  1. Install the binary globally:
sudo mv target/release/gs /usr/local/bin/

Now, you can use the gs command from anywhere on your system.

Contributions

Contributions are welcome! Feel free to fork the repository and submit pull requests.

License

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

Dependencies

~5–17MB
~229K SLoC