scratch/content/html/fr/blog/05_git_create_remote_branch.md

42 lines
914 B
Markdown
Raw Normal View History

2010-02-17 12:27:01 +00:00
-----
kind: article
menupriority: 1
created_at: 2009-08-17T14:00:00+02:00
2010-04-29 14:59:14 +00:00
title: Création de branches externe avec Git
2010-05-09 12:53:46 +00:00
author_name: Yann Esposito
author_uri: yannesposito.com
2010-02-17 12:27:01 +00:00
tags:
- git
- branch
- local
- remote
-----
## Créer une branche Git externe facilement
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 *externe* (remote).
Voici le script que j'utilise pour accomplir cette tâche :
<div>
<code class="zsh" file="git-create-new-branch.sh">
#!/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}
</code>
</div>
Bien sûr, je suppose qu'<code>origin</code> est déjà configurée.
2010-04-29 14:59:14 +00:00