GithubHelp home page GithubHelp logo

jimscard / git-add-remote Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caarlos0-graveyard/git-add-remote

0.0 0.0 0.0 18 KB

ZSH plugin to easily add the upstream remote to your git fork.

License: MIT License

Shell 100.00%

git-add-remote's Introduction

git-add-remote Build Status

A shell plugin to easily add remotes to git repositories.

Why

It is so damn boring to type or copy and paste the URLs changing only the fork name.

Usage

Given that you are in a valid git managed folder, with a remote named origin, you can, for example, add your company's remote as upstream:

$ add-upstream company

$ git remote -v
origin  [email protected]:caarlos0/random.git (fetch)
origin  [email protected]:caarlos0/random.git (push)
upstream  [email protected]:company/random.git (fetch)
upstream  [email protected]:company/random.git (push)

Or even add your coworker's remote to work in some branch together:

$ add-remote my-coworker

$ git remote -v
origin  https://github.com/caarlos0/random.git (fetch)
origin  https://github.com/caarlos0/random.git (push)
my-coworker  https://github.com/my-coworker/random.git (fetch)
my-coworker  https://github.com/my-coworker/random.git (push)

Some people have hard aliases in github, so you can even set the remote's name:

$ add-remote _c0w0rk3r_0x12 newguy

$ git remote -v
origin  [email protected]:caarlos0/random.git (fetch)
origin  [email protected]:caarlos0/random.git (push)
newguy  [email protected]:_c0w0rk3r_0x12/random.git (fetch)
newguy  [email protected]:_c0w0rk3r_0x12/random.git (push)

newguy's tend to multiply, so I don't recommend naming it like that.

Installation

It was innitialy made to be used in ZSH, so, if you use antibody, antigen, or whatever, just bundle it:

$ antibody bundle caarlos0/git-add-remote

If you use bash, you can clone this repo somewhere or just download the add-remote.sh file and source the add-remote.sh file in your ~/.profile or wherever you like.

Fig

Fig adds apps, shortcuts, and autocomplete to your existing terminal.

Install git-add-remote in just one click.

git aliasing

$ git config --global alias.add-upstream '!zsh -ic \"add-upstream $*\"''
$ git config --global alias.add-remote '!zsh -ic \"add-remote $*\"''
$ git add-upstream org
$ git add-remote user remote_name
$ git add-remote user

These examples are for zsh, but I'm pretty sure they also work on bash by replacing zsh -ic with bash -ic.

git-add-remote's People

Contributors

caarlos0 avatar frankhinek avatar ibayramli 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.