从git cli工具管理存储库服务的工具

git-repo的Python项目详细描述


git repo:git services cli实用程序
---------------------------

-获取源代码:
-https://github.com/guyzmo/git repo
-https://gitlab.com/guyzmo/git repo
-https://bitbucket.org/guyzmo/git repo
-发布:https://github.com/guyzmo/git repo/issues
-与社区见面,来聊天:
-在IRC上:[git repo
@freenode](https://webchat.freenode.net/?频道=git repo)
-在matrix上:
` git repo:matrix.org<;https://riot.im/app//room/git repo:matrix.org>;`
-在gitter上:
`git services/git repo<;https://gitter.im/git services/git repo>;`_
-问题已准备就绪问题正在处理显示Travis生成状态
-` PYPI版本PYPI
下载<;https://pypi.python.org/pypi/git repo>;`_

寻求帮助在过去的几个月里,我一直在忙着编写能把食物摆在桌上的东西……不幸的是,我无法给这个项目带来它应得的全部爱。这就是为什么我花了几个月的时间来合并并发布这个存储库中的prs。


问题
支持…


,因此我想与其他人或更多人分担维护责任。如果您感兴趣,请通过irc或邮件(在我的所有提交中
)向我发送ping。我总是很乐意指导代码的设计!

用法
~br/>

main commands
^^^^^^^^^^^^^

`_。
要从GitHub中克隆新项目,只需发布:

:::


%Git Hub克隆Guyzmo/Git Repo

您自己的
git lab或gogs:

::

%git lab clone guyzmo/git repo
%git bb clone guyzmo/git repo
%git myprecious clone guyzmo/git repo
%git gg clone guyzmo/git repo

git lab clone guyzmo/git repo master

尽管有时,当您开始一个新项目时,您希望创建一个
要推送到的新存储库:





%git hub create guyzmo/git repo

实际上命名空间是临时的,根据默认设置,您只能(并希望
)在自己的帐户中创建新存储库。


这很容易做到:




%git lab add guyzmo/git repo

,它将添加``https://gitlab.com/guyzmo/git repo``作为``gitlab``
远程!

此外,还可以使用:

::


%git hub fork neovim/neovim

使用"open"命令:

::

%git lab open guyzmo/git repo
成功地将"guyzmo/git repo"的分支"2"提取到"request-2"!

合并请求*(即拉请求,即合并请求)*
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^您可以使用``request``命令检查
merge的请求(也称为git hub上的pull请求):

::

%git hub request guyzmo/git repo list
要合并的打开请求列表:
id title url
2更喜欢gitrep。<;target>;.token>;privatekey,docs https://api.github.com/repos/guyzmo/git repo/issues/2

在合并之前检查和/或修改它:




%git hub request guyzmo/git repo fetch 2

功能…'

您也可以通过调用:





%git hub request create

该命令有一点automagic,它将:

>1来创建请求。查找当前分支的名称空间和项目(或者至少在"github"远程分支(如果使用"hub"调用)上
),并将其作为请求的源;
2。对于请求的目标,它将查找并获取:

-如果当前项目有父项,则为父项;如果没有父项,则为父项;如果没有父项,则为父项。它将接受源
4的当前加载分支。以及目标
5的默认值。调用服务请求将请求从源合并到目标。


gists或snippets
^^^^^^^^^^^^^^^^^


最后,您可以使用的另一个额外功能是gist处理:



%git hub gist list
id标题
https://gist.git hub.com/4a0dd9177524b2b125e9166640666737这是测试要点

unicode_combined.py
%git hub-v gist list https://gist.github.com/4a0dd9177524b2b125e9166640666737
语言大小名称
标记16自述文件.md
文本14许可证
重新构造文本17自述文件.rst

本地输出,您可以使用fetch命令(如果有多个,则指定
文件):

::

%git hub gist fetch https://gist.github.com/a7ce4fddba7744ddf335>;mygist.py
%git hub gist fetch 4a0dd9177524b2b125e9166640666737 license>;license-更彻底的修改或咨询,您也可以克隆
它:

::


%git hub gist克隆4a0dd9177524b2b125e9166640666737
从github拉取将"4a0dd9177524b2b125e9166640666737"克隆到"/4a0dd9177524b2b125e9166640666737"!

完成后,您只需删除它:

:::


%git hub gist-f delete 4a0dd9177524b2b125e9166640666737
成功删除gist!

*nota bene*:由于"git"cli的灵活性,通过安装"git repo",您可以使用"git repo hub…"或"git repo hub…"直接访问该工具。对于"git hub…``
调用,您必须设置别名,请参见下面的配置方法。

remotes
^^^^^^

`` origin``但它鼓励使用多个,并且
让您控制"origin"指向的任何位置。


这就是为什么从服务克隆或在
服务上创建新的repo时,它使用的是一个特殊的远程服务器,它带有
服务的名称:




%git hub clone foo/bar;cd bar
%git status-sb head-1
\master…github/master
^^^^^
%git lab create bar
%git push gitlab master

因此,您可以用一个命令将代码推送到所有远程存储库:

::

%git push all master

另一个特殊的远程存储库是"upstream"。当您执行
项目的fork时,当前具有服务名称的特殊远程服务器将重命名为
``upstream`,并且wly forked project现在是服务名为


::

%git lab clone foo/bar;cd bar
%git remote
all
gitlab
%git lab fork
%git remote
all
gitlab
upstream

如果要链接其他现有项目,可以使用
``add``命令:

::


%git bb add foo/bar
%;如果名称与当前项目相同,您不需要添加名称
%git hub add
%git gg add foo/bar gitea--alone

上面也可以使用以下命令来完成:

::

%git remote add gitbucket https://gitbucket.local:8080/foo/bar
%\--单独跳过此步骤
%git remote set url--添加所有https://gitbucket.local:8080/foo/bar


,要删除远程,只需执行以下操作:



%git remote remove github

installation
~python2
和python3都已安装:




%pip安装git repo


,或者通过获取源代码并运行:





配置
~以下命令:

:::

%git repo config

,向导将运行您获取
服务的身份验证令牌、添加命令别名或远程名称。不过,
配置自定义服务仍然不由向导处理……

,但如果您喜欢手动配置,则必须调整
```~/.gitconfig``。每次你有帐户的服务,你必须在gitconfig中创建一个部分:

::


[gitrepo"gitlab"]
token=yourVerySecretKey

[gitrepo"github"]
token=yourVerySecretKey

[gitrepo"bitbucket"]
username=ford.prefict
token=yourothersecretkey

[gitrepo"gogs"]
fqdn=urlofyourgos
token=yourverysecretkey

在这里,我们设置了基本的设置:只设置私有令牌。您将注意到
对于bitbucket,私有令牌是您的用户名和密码
,由一列分隔。这是因为BitBucket不提供丢弃的工具专用令牌(我可能会在某些点上实现BB的OAuth)。


token=yourothersecretkey

,它将更改您使用的名称的命令,您将喜欢处理您使用的服务的操作:




%git repo bit clone guyzmo/git repo

使用该
配置:

::

[gitrepo"myprecious"]
type=gitlab
token=yoursupperprivatekey
fqdn=gitlab.example.org
=是的,最后,为了让它变得很酷,您可以在
gitconfig中创建几个别名:

::


[别名]
hub=repo hub
lab=repo lab
bb=repo bb
perso=repo perso

,这样您就可以将该工具作为git子命令运行:




git hub cloneguyzmo/git repo

对于那些喜欢将所有dotfile保存在git存储库中的人来说,在存储库中存储能够访问您的社交帐户的令牌将是非常可怕的……我甚至没有提到那些想共享您的点文件。但别担心,一旦全部配置完毕,您就可以启动
您最喜欢的编辑器http://www.vim.org>;```并将所有
```[gitrepo…]``部分移动到一个新文件中,类似于` ~/.git config repos`。

您可以更改默认值:

::



启动一个virtualenv并从内部安装devel
需求:

:::

%virtualenv var
%var/bin/pip install-r requirements test.txt


测试:



%var/bin/py.test--cov=git_repo--cov report term missing--capture=sys tests


n.b.:*不再支持构建用于开发*

"git repo"的详细程度
。你给出的参数越多,你得到的详细信息就越多。

-`-v``将调试级别设置为``debug``,给出一些执行信息`
-`-vv``将打印出正在执行的所有git命令`;
-`-vvv``将更详细地了解git层;
-`-vvv``将输出所有具有不同
api;
-`-vvvv``的http交换将打印出如何解析参数。


测试
''


:bin/py.test

py.test可以使用以下选项帮助您在
测试失败时进行调试:

-`-v``将显示有关错误的详细信息
-`-x``将在第一次失败时停止
-`--`-pdb``将在出现异常的地方启动调试器
启动的

测试使用交换的http数据的记录,因此在对api进行较小的
更改测试时,我们不需要
真实凭据和真实连接。这些录音被称为磁带,这要归功于
`betamax<;https://github.com/sigmavirus24/betamax>;``框架正在测试套件中使用。


运行现有测试时,基于提供的磁带,不需要任何设置。另外,如果您在
` ` ~/.gitconfig``中有一个配置,那么测试将使用它们。无论如何,您可以将
环境变量用于这些设置(环境变量将
优先于配置设置):

您可以设置以下环境
变量:

-``github`u namespace``(默认为``not`u configured```)是要在github上使用的帐户名
-``gitlab`u namespace`(默认为``not`u configured```)是要在其上使用的帐户名
gitlab
-`` bitbucket_namespace``(默认为``未配置```)是要在bitbucket上使用的帐户名
-`` gogs_namespace``(默认为``未配置```),是要在gogs上使用的帐户名
-`` private_key_github``您的私有令牌您已经在github上设置了
您的帐户
-``private\u gitlab``您在gitlab上设置的私人令牌
您的帐户
-``private\u key\u bitbucket``您在
bitbucket上设置的私人令牌
-``private\u key\u gogs``您的私人令牌在gogs上为您的帐户设置


todo
~~~~

-[x]生成一个"git repo fork"操作
-[x]使您可以选择方法(ssh或https)
-[x]正确处理默认分支
-[x]使您可以一次推送到所有远程
-[x]重构代码在多个模块中添加回归测试(和实际值我会找到一个聪明的方法来实现
them…
-[x]add travis build
-[x]显示一个很好的进度条,而它正在抓取(cf
``15<;https://github.com/guyzmo/git repo/issues/15>;``uuu)
-[x]添加对处理gist的支持(cf
``12<;https://github.com/guyzmo/git repo/issues/12>;`,cf
` 13<;https://github.com/guyzmo/git repo/issues/13>;`<-[x]添加对处理请求的支持(cf
` 10<;https://github.com/guyzmo/git repo/issues/10>;`https://github.com/guyzmo/git repo/issues/11>;`
-[x]添加对Bitbucket的应用程序令牌支持(cf
` 14<;https://github.com/guyzmo/git repo/issues/14>;`
-[x]添加对GOGS的支持(cf
` 18<;https://github.com/guyzmo/git repo/issues/18>;`_)
-[x]添加对gitbucket的支持(cf
` 142<;https://github.com/guyzmo/git repo/issues/142>;` br/>-[]添加对管理ssh密钥的支持(cf
` 22<;https://github.com/guyzmo/git repo/issues/22>;` br/>-[]添加对问题的支持(cf
` 104<;https://github.com/guyzmo/git repo/issues/104>;`` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `>-对于更多的功能,写一个问题,甚至更好,公关!

contributors
==



项目和原始想法由以下人员提出并维护:

-bernard[@guyzmo](https://github.com/guyzmo)pratz-
`commits<;https://github.com/guyzmo/git-repo/commits?author=guyzmo>;`\uuu

,代码贡献来自:

-[@pyhedgehog](https://github.com/pyhedgehog)-
`commits<;https://github.com/guyzmo/git-repo/commits?author=pyhedgehog>;``你
-[@guyhughes](https://github.com/guyhughes)-
`提交<;https://github.com/guyzmo/git-repo/commits?author=guyhughes>;`\uu
-[@buaazp](https://github.com/buaazp)-
`提交<;https://github.com/guyzmo/git-repo/commits?author=buaazp>;`\uu
-[@peterazmanov](https://github.com/peterazmanov)-
`提交<;https://github.com/guyzmo/git-repo/commits?author=peterazmanov>;`\uu
-[@crazybus](https://github.com/crazybus)-
`提交<;https://github.com/guyzmo/git-repo/commits?author=crazyBus>;`
-[@rnestler](https://github.com/rnestler)-
`提交<;https://github.com/guyzmo/git-repo/commits/devel?author=rnestler>;`
-[@jayvdb](https://github.com/jayvdb)-
`提交<;https://github.com/guyzmo/git-repo/commits/devel?author=jayvdb>;`\uuu
-[@kounoike](https://github.com/kounoike)-
`提交<;https://github.com/guyzmo/git-repo/commits/devel?author=kounoike>;`
-[@amandacameron](https://github.com/amandacameron)-
`提交<;https://github.com/guyzmo/git-repo/commits/devel?author=amandacameron>;`\uu
-[@fa7ad](https://github.com/fa7ad)-
`提交<;https://github.com/guyzmo/git-repo/commits/devel?author=fa7ad>;``uuu


许可证
~~~~~




版权所有©20162017 Bernard`Guyzmo`Pratz<;Guyzmo+Git Repo+pub@m0g.net>;

此程序是免费软件;您可以重新分发它和/或BR/>在自由软件基金会发布的GNU通用公共许可证BR/>的条款下修改它;2版的BR/>许可证,或者(按您的选择)任何版本。有用,
但没有任何保证;甚至没有针对特定用途的适销性或适用性的暗示保证。有关详细信息,请参阅GNU通用公共许可证。

TWARE < BR/>基金会,51富兰克林街,第五楼,波士顿,MA 02110-1301,USA. < BR> > BR/>见许可证文件的完整许可证。< BR/> BR/>< < BR> > BR/>…|准备好了吗?图片:https://badge.waffle.io/guyzmo/git-repo.png?label=ready&title=ready
:目标:https://waffle.io/guyzmo/git repo
…|进行中的问题图像::https://badge.waffle.io/guyzmo/git-repo.png?label=in%20progress&;title=progress
:目标:https://waffle.io/guyzmo/git repo
…|显示Travis构建状态图像::https://travis ci.org/guyzmo/git repo.svg
:目标:https://travis ci.org/guyzmo/git repo
…| pypi版本image::https://img.shields.io/pypi/v/git repo.svg
…| pypi下载图像::https://img.shields.io/pypi/dm/git repo.svg

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在初始化外部禁用JButton   java允许Spring MVC 3.0中的音频文件?   java为什么会突然出现这种maven错误   java Spring引导配置属性问题   java强制转换到父对象更改对象引用?   java泛型平均需要泛型类型,但需要int   java jnlp log4j ClassNotFoundException   java将具有位的数组转换为一个字节   jsp将运行时生成的类存储在java web应用程序的何处?   控制安卓 studio中从布局文件到MainActivity的流。JAVA   java动态编程(Codibility Q:NumberSolitaire)   java GWT XSS预防和呈现安全/简单html   java Firebase无法识别用于设置值的字符串键   java如何为行和列创建字符串索引表,为单元格创建布尔值?   java如何从构造函数返回错误消息(字符串)?   java修改请求消息体   java如何将庞大的id列表(例如)传递给ApacheSpark定制数据源