2021-04-18 10:23:24 +00:00
<!DOCTYPE html>
< html lang = "fr" >
< head >
< meta charset = "utf-8" >
< title > YBlog - Création de branches externe avec Git< / title >
< meta name = "keywords" content = "git, branch, local, remote" / >
< link rel = "shortcut icon" type = "image/x-icon" href = "../../../../Scratch/img/favicon.ico" / >
2022-10-26 09:38:50 +00:00
< link rel = "stylesheet" type = "text/css" href = "../../../../css/y.css" / >
2021-05-25 20:25:47 +00:00
< link rel = "stylesheet" type = "text/css" href = "/css/legacy.css" / >
< link rel = "alternate" type = "application/rss+xml" title = "RSS" href = "/rss.xml" / >
2021-04-18 10:23:24 +00:00
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< link rel = "apple-touch-icon" href = "../../../../Scratch/img/about/FlatAvatar@2x.png" / >
<!-- [if lt IE 9]>
< script src = "http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js" > < / script >
<![endif]-->
<!-- IndieAuth -->
< link href = "https://twitter.com/yogsototh" rel = "me" >
< link href = "https://github.com/yogsototh" rel = "me" >
< link href = "mailto:yann.esposito@gmail.com" rel = "me" >
< link rel = "pgpkey" href = "../../../../pubkey.txt" >
< / head >
< body lang = "fr" class = "article" >
< div id = "content" >
< div id = "header" >
< div id = "choix" >
< span id = "choixlang" >
< a href = "../../../../Scratch/en/blog/05_git_create_remote_branch/" > Anglais< / a >
< / span >
< span class = "tomenu" > < a href = "#navigation" > ↓ Menu ↓< / a > < / span >
< span class = "flush" > < / span >
< / div >
< / div >
< div id = "titre" >
< h1 > Création de branches externe avec Git< / h1 >
< / div >
< div class = "flush" > < / div >
< div id = "afterheader" class = "article" >
< div class = "corps" >
< p > < em > Edit: Maintenant j’ utilise < code > git push -u< / code > < / em > < / p >
< h2 id = "créer-une-branche-git-externe-facilement" > Créer une branche Git externe facilement< / h2 >
< p > 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).< / p >
< p > Voici le script que j’ utilise pour accomplir cette tâche :< / p >
< div class = "sourceCode" id = "cb1" > < pre class = "sourceCode zsh" > < code class = "sourceCode zsh" > < a class = "sourceLine" id = "cb1-1" title = "1" > < span class = "co" > #!/usr/bin/env zsh< / span > < / a >
< a class = "sourceLine" id = "cb1-2" title = "2" > < / a >
< a class = "sourceLine" id = "cb1-3" title = "3" > < span class = "kw" > if< / span > < span class = "kw" > ((< / span > < span class = "ot" > $#< / span > < 1< span class = "kw" > ))< / span > ; < span class = "kw" > then< / span > < / a >
< a class = "sourceLine" id = "cb1-4" title = "4" > < span class = "kw" > print< / span > -- < span class = "st" > " usage: < / span > < span class = "ot" > $0< / span > < span class = "st" > :t branch_name" < / span > < span class = "kw" > > & 2< / span > < / a >
< a class = "sourceLine" id = "cb1-5" title = "5" > < span class = "kw" > exit< / span > 1< / a >
< a class = "sourceLine" id = "cb1-6" title = "6" > < span class = "kw" > fi< / span > < / a >
< a class = "sourceLine" id = "cb1-7" title = "7" > < / a >
< a class = "sourceLine" id = "cb1-8" title = "8" > < span class = "ot" > branch=$1< / span > < / a >
< a class = "sourceLine" id = "cb1-9" title = "9" > git br < span class = "ot" > ${branch}< / span > < / a >
< a class = "sourceLine" id = "cb1-10" title = "10" > git < span class = "kw" > co< / span > < span class = "ot" > ${branch}< / span > < / a >
< a class = "sourceLine" id = "cb1-11" title = "11" > git config branch.< span class = "ot" > ${branch}< / span > .remote origin< / a >
< a class = "sourceLine" id = "cb1-12" title = "12" > git config branch.< span class = "ot" > ${branch}< / span > .merge refs/heads/< span class = "ot" > ${branch}< / span > < / a > < / code > < / pre > < / div >
< p > Bien sûr, je suppose qu’ < code > origin< / code > est déjà configurée.< / p >
< / div >
< div id = "afterarticle" >
< div id = "social" >
2021-05-25 20:25:47 +00:00
< a href = "/rss.xml" target = "_blank" rel = "noopener noreferrer nofollow" class = "social" > RSS< / a >
2021-04-18 10:23:24 +00:00
·
< a href = "https://twitter.com/home?status=http%3A%2F%2Fyannesposito.com/Scratch/fr/blog/05_git_create_remote_branch/%20via%20@yogsototh" target = "_blank" rel = "noopener noreferrer nofollow" class = "social" > Tweet< / a >
·
< a href = "http://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fyannesposito.com/Scratch/fr/blog/05_git_create_remote_branch/" target = "_blank" rel = "noopener noreferrer nofollow" class = "social" > FB< / a >
< br / >
< a class = "message" href = "../../../../Scratch/fr/blog/Social-link-the-right-way/" > Ces liens sociaux préservent votre vie privée< / a >
< / div >
< div id = "navigation" >
< a href = "../../../../" > Accueil< / a >
< span class = "sep" > ¦< / span >
< a href = "../../../../Scratch/fr/blog" > Blog< / a >
< span class = "sep" > ¦< / span >
< a href = "../../../../Scratch/fr/softwares" > Logiciels< / a >
< span class = "sep" > ¦< / span >
< a href = "../../../../Scratch/fr/about" > Auteur< / a >
< / div >
< div id = "totop" > < a href = "#header" > ↑ Top ↑< / a > < / div >
< div id = "bottom" >
< div >
Published on 2009-08-17
< / div >
< div >
< a href = "https://twitter.com/yogsototh" > Follow @yogsototh< / a >
< / div >
< div >
< a rel = "license" href = "http://creativecommons.org/licenses/by/3.0/deed.en_US" > Yann Esposito©< / a >
< / div >
< div >
Done with
< a href = "http://www.vim.org" target = "_blank" rel = "noopener noreferrer nofollow" > < strike > Vim< / strike > < / a >
< a href = "http://spacemacs.org" target = "_blank" rel = "noopener noreferrer nofollow" > spacemacs< / a >
< span class = "pala" > & < / span >
< a href = "http://nanoc.ws" target = "_blank" rel = "noopener noreferrer nofollow" > < strike > nanoc< / strike > < / a >
< a href = "http://jaspervdj.be/hakyll" target = "_blank" rel = "noopener noreferrer nofollow" > Hakyll< / a >
< / div >
2022-10-26 09:26:08 +00:00
2021-04-18 10:23:24 +00:00
< / div >
< / div >
< / div >
< / div >
< / body >
< / html >