scratch/content/html/en/blog/05_git_create_remote_branch.md
2010-03-30 16:39:12 +02:00

1.3 KiB

kind menupriority created_at title multiTitle multiDescription tags
article 1 2009-08-17T14:00:00+02:00 Git remote branch creation
fr en
Création de branches avec Git Git branch Creation
fr en
J'utilise Git pour synchroniser des projets personnels. C'est pourquoi quand je crée une branche locale je souhaite quasiment toujours qu'elle soit aussi créée en <em>externe</em> (remote).<br/>Voici le script que j'utilise pour accomplir cette tâche ... I use git to synchronize personnal projects. Therefore, most of time, when I create a local branch I want it to be created remotely.<br/>Here is the script I use to achieve that…
git
branch
local
remote

easiest remote Git branch creation

I use git simply to synchronize stuff for personnal projects. Therefore, when I create a local branch I want most of time this branch to be created remotely.

Here is the script I use to achieve that:

#!/usr/bin/env zsh

if (($#<1)); then print -- "usage: $0:t branch_name" >&2 exit 1 fi

branch=$1 git br ${branch} git co ${branch} git config branch.${branch}.remote origin git config branch.${branch}.merge refs/heads/${branch}

Of course, I suppose origin is already configured.