git 命令的用法

一. 远程仓库相关的操作命令

    1.git remote : 用于管理主机名。列出远程库的名字。

$ git remote
vote

    2. git remote -v/--verbose 显示出详细的url地址名和对应的别名。

$ git remote -v
vote    http://git.doabit.com/jssdb/wmt_vote.git (fetch)
vote    http://git.doabit.com/jssdb/wmt_vote.git (push)

    3. git remote add name url  添加远程仓库,一旦添加以后别名就代表远程库的版本库地址,可以直接使用。

$ git remote add joey [email protected]:zhaoJoeyuan/Test.git
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote -v
joey    [email protected]:zhaoJoeyuan/Test.git (fetch)
joey    [email protected]:zhaoJoeyuan/Test.git (push)
origin  [email protected]:zhaoJoeyuan/TestTwo.git (fetch)
origin  [email protected]:zhaoJoeyuan/TestTwo.git (push)

    4.  git remote remove name  删除添加的远程库

$ git remote remove joey
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote -v
origin  [email protected]:zhaoJoeyuan/TestTwo.git (fetch)
origin  [email protected]:zhaoJoeyuan/TestTwo.git (push)

    5. git remote rename 原名字 新名字  :    重命名远程库

$ git remote rename origin joey
Administrator@9GPBSPCCTFQXEUX MINGW64 /e/TestTwo (test)
$ git remote -v
joey    [email protected]:zhaoJoeyuan/TestTwo.git (fetch)
joey    [email protected]:zhaoJoeyuan/TestTwo.git (push)

    文章参考自: https://blog.csdn.net/zy00000000001/article/details/70505150

猜你喜欢

转载自www.cnblogs.com/siyecao2010/p/9187075.html