|
Namegit-subrepo - Git Submodule AlternativeSynopsisgit subrepo -h # Help Overview git subrepo clone <remote-url> [<subdir>] git subrepo init <subdir> git subrepo pull <subdir> git subrepo push <subdir> git subrepo fetch <subdir> git subrepo branch <subdir> git subrepo commit <subdir> git subrepo config <subdir> git subrepo status [<subdir>] git subrepo clean <subdir> git subrepo help [<command> | --all] git subrepo version git subrepo upgrade DescriptionThis git command "clones" an external git repo into a subdirectory of your repo. Later on, upstream changes can be pulled in, and local changes can be pushed back. Simple.BenefitsThis command is an improvement from "git-submodule" and "git-subtree"; two other git commands with similar goals, but various problems.It assumes there are 3 main roles of people interacting with a repo, and attempts to serve them all well:
The "git-subrepo" command benefits these roles in the following ways:
InstallationThe best short answer is:git clone https://github.com/ingydotnet/git-subrepo /path/to/git-subrepo echo 'source /path/to/git-subrepo/.rc' >> ~/.bashrc The complete "Installation Instructions" can be found below. Note: git-subrepo needs a git version (> 2.7) that supports worktree:s. CommandsAll the subrepo commands use names of actual Git commands and try to do operations that are similar to their Git counterparts. They also attempt to give similar output in an attempt to make the subrepo usage intuitive to experienced Git users.Please note that the commands are not exact equivalents, and do not take all the same arguments. Keep reading…
Command Options
Output Options
Environment VariablesThe "git-subrepo" command exports and honors some environment variables:
Installation InstructionsThere are currently 3 ways to install "git-subrepo". For all of them you need to get the source code from GitHub:git clone https://github.com/ingydotnet/git-subrepo /path/to/git-subrepo The first installation method is preferred: "source" the ".rc" file. Just add a line like this one to your shell startup script: source /path/to/git-subrepo/.rc That will modify your "PATH" and "MANPATH", and also enable command completion. The second method is to do these things by hand. This might afford you more control of your shell environment. Simply add the "lib" and "man" directories to your "PATH" and "MANPATH": export GIT_SUBREPO_ROOT="/path/to/git-subrepo" export PATH="/path/to/git-subrepo/lib:$PATH" export MANPATH="/path/to/git-subrepo/man:$MANPATH" See below for info on how to turn on Command Completion. The third method is a standard system install, which puts "git-subrepo" next to your other git commands: make install # Possibly with 'sudo' This method does not account for upgrading and command completion yet. WindowsThis command is known to work in these Windows environments:
Let us know if there are others that it works (or doesn't work) in. TestingThe "git-subrepo" repository comes with a extensive test suite. You can run it with:make test or if you don't have "make" on your system: prove -v test UpgradingIf you used the ".rc" or "PATH" method of installation, just run this to upgrade "git-subrepo":git subrepo upgrade Or (same thing): cd /path/to/git-subrepo git pull If you used "make install" method, then run this again (after "git pull"): make install # Possibly with 'sudo' Command CompletionThe "git subrepo" command supports "<TAB>"-based command completion. If you don't use the ".rc" script (see Installation, above), you'll need to enable this manually to use it.In BashIf your Bash setup does not already provide command completion for Git, you'll need to enable that first:source <Git completion script> On your system, the Git completion script might be found at any of the following locations (or somewhere else that we don't know about):
In case you can't find any of these, this repository contains a copy of the Git completion script: source /path/to/git-subrepo/share/git-completion.bash Once Git completion is enabled (whether you needed to do that manually or not), you can turn on "git-subrepo" completion with a command like this: source /path/to/git-subrepo/share/completion.bash In zshIn the Z shell (zsh), you can manually enable "git-subrepo" completion by adding the following line to your "~/.zshrc", before the "compinit" function is called:fpath=('/path/to/git-subrepo/share/zsh-completion' $fpath) StatusThe git-subrepo command has been in use for well over a year and seems to get the job done. Development is still ongoing but mostly just for fixing bugs.Trying subrepo out is simple and painless (this is not "git submodule"). Nothing is permanent (if you do not push to shared remotes). ie You can always play around and reset back to the beginning without pain. This command has a test suite (run "make test"), but surely has many bugs. If you have expertise with Git and subcommands, please review the code, and file issues on anything that seems wrong. If you want to chat about the "git-subrepo" command, join "#gitcommands" on "irc.freenode.net". Notes
Authors
License and CopyrightThe MIT License (MIT)Copyright (c) 2013-2020 Ingy döt Net
Visit the GSP FreeBSD Man Page Interface. |