Giter VIP home page Giter VIP logo

git-project's Introduction

git-project

image

Scripts extending git for better project and sub-repository management

Overview Video

Git Project

Purpose

git-project serves as an alternative to other git sub-module/sub-repo solutions. It is meant to be used in situations where both the parent repository and sub-repositories are rapidly changing. This differs from existing solutions such as git sub-modules which work best when sub-repositories are mostly stable.

git-project keeps track of which branches you should be on in all your repositories when you are working on a given feature. So, if you're working on feature X on a given branch in your main repository, which depends on branch Y in sub-repo A and branch X in sub-repo B, git-project keeps track of that for you! Then, if you want to stop and work on a different feature that depends on an entirely different set of branches, you can switch to it with a single command.

Install

Run make install (or sudo make install) This will install the git-project python script into your /usr/local/bin/.

To uninstall, simply run make uninstall

Setup

  1. Create a .gitproj file with the format

    repos:
        subrepo1-name local/path/to/repo1 remote-url-subrepo1
        subrepo2-name local/path/to/repo2 remote-url-subrepo2

    The first column (subrepo-name) is a memorable key for each repository that you will use when saving or loading that repo (see below).

    The second column is the local directory where you would like to store each repository (relative to the .gitproj file).

    The final column is the remote url from which to clone the repository.

  2. Run git project init from the root of your project. This will attempt to clone the sub-repositories and add them to your .gitignore.

    If you have already cloned the sub-repositories, skip the git project init step, but make sure the sub-repositories are listed in your .gitignore.

Usage

git-project is used to save and load the state of your repository and subrepositories. A state is the collection of feature branches for each repository.

Saving

To save the current state of all subrepositories, call

git project save

To save only certain specified repositories, use

git project save -- repo1-name repo2-name ...

This writes the current branch as well as the latest commit on that branch for each subrepository, into the .gitproj file. You should then add and commit the .gitproj file like normal:

git add .gitproj && git commit -m "Update gitproj"

Loading

To return to this state later, just switch to the branch in your base repository where you saved the state, and run

git project load.

This resets your subrepository's local branch to the commit stored in the .gitproj file. If you have unpushed changes in the subrepository, you will be prompted to push these before updating your branch to ensure your commits aren't orphaned.

If you want to load the exact commits on detached heads rather than resetting your local branch, use

git project load --commit.

Similar to saving, you can load only specific repositories with

git project load -- repo1-name repo2-name

Other

Optional flags you can pass to git project include:

--autoclone (-a): Autoclone repos in .gitproj that aren't in the directory

--automerge (-m): Automerge branch updates when loading

--force (-f): don't prompt, will automatically merge or clone when loading, and overwrite .gitproj when saving

--update (-u): when loading, will update all branches to the most recent commit on the saved branch (rather than the saved commit).

--: separates flags from the list of repos to save/load. If not specified, all repos will be saved/loaded

Bugs

If you run into any problems with git-project, please make an issue

git-project's People

Contributors

mfirmin avatar yxwww avatar bsmithyman avatar rowanc1 avatar testpersonal avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.