{"id":519,"date":"2016-06-13T01:08:11","date_gmt":"2016-06-13T04:08:11","guid":{"rendered":"http:\/\/www.henriquereis.com\/?p=519"},"modified":"2016-06-13T01:12:39","modified_gmt":"2016-06-13T04:12:39","slug":"auto-sincronizar-repositorios-do-github-ou-bitbucket","status":"publish","type":"post","link":"https:\/\/henriquereis.com\/blog\/auto-sincronizar-repositorios-do-github-ou-bitbucket\/","title":{"rendered":"Auto sincronizar reposit\u00f3rios do github ou bitbucket"},"content":{"rendered":"<p>Recentemente vi alguns projetos opensource simplesmente serem removidos ou passaram a ser pagos, e alguns pegam a gente de surpresa, ent\u00e3o pensei em algo para auto sincronizar alguns reposit\u00f3rios para garantir que terei a \u00faltima vers\u00e3o.<\/p>\n<p>O c\u00f3digo \u00e9 relativamente simples:<\/p>\n<p>&nbsp;<br \/>\n<code>#!\/bin\/bash<br \/>\nif [ ! -z \"$1\" ]; then<br \/>\n  if [ -d $1 ] && [ $1 != \".\" ]; then<br \/>\n    cd \"$1\"<br \/>\n    pwd<br \/>\n    git pull<br \/>\n  fi<br \/>\n  exit 0<br \/>\nfi<\/p>\n<p>file=$0<br \/>\nstart=$(echo ${0} | cut -c1-1)<br \/>\nif [ \"$start\" != \".\" ] && [ \"$start\" != \"\/\" ]; then<br \/>\n  file=\".\/$0\"<br \/>\nfi<br \/>\nfind -maxdepth 1 -exec \"$file\" {} \\;<\/p>\n<p>exit 0;<br \/>\n<\/code><br \/>\nSe voc\u00ea quer entender melhor o c\u00f3digo e porque ele foi criado, assista ao v\u00eddeo<\/p>\n<div class=\"video-container\">\n<iframe loading=\"lazy\" width=\"560\" height=\"315\" src=\"https:\/\/www.youtube.com\/embed\/chhwQruKgM0?rel=0\" frameborder=\"0\" allowfullscreen><\/iframe>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Recentemente vi alguns projetos opensource simplesmente serem removidos ou passaram a ser pagos, e alguns pegam a gente de surpresa, ent\u00e3o pensei em algo para auto sincronizar alguns reposit\u00f3rios para garantir que terei a \u00faltima vers\u00e3o. O c\u00f3digo \u00e9 relativamente simples: &nbsp; #!\/bin\/bash if [ ! -z &#8220;$1&#8221; ]; then if [ -d $1 ] &hellip; <a href=\"https:\/\/henriquereis.com\/blog\/auto-sincronizar-repositorios-do-github-ou-bitbucket\/\" class=\"more-link\">Continue lendo <span class=\"screen-reader-text\">Auto sincronizar reposit\u00f3rios do github ou bitbucket<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/posts\/519"}],"collection":[{"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/comments?post=519"}],"version-history":[{"count":3,"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/posts\/519\/revisions"}],"predecessor-version":[{"id":522,"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/posts\/519\/revisions\/522"}],"wp:attachment":[{"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/media?parent=519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/categories?post=519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/henriquereis.com\/blog\/wp-json\/wp\/v2\/tags?post=519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}