{"id":26154,"date":"2016-06-03T09:10:03","date_gmt":"2016-06-03T07:10:03","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=26154"},"modified":"2016-06-03T09:10:03","modified_gmt":"2016-06-03T07:10:03","slug":"deploying-with-git","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/","title":{"rendered":"Deploying with git"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p><a href=\"https:\/\/git-scm.com\/\">Git<\/a> is an excellent version control, but it&#8217;s more than just that. \u00a0A lot of people use it to deploy their projects as well. \u00a0Most suggestions (for example, <a href=\"https:\/\/www.digitalocean.com\/community\/tutorials\/how-to-set-up-automatic-deployment-with-git-with-a-vps\">this tutorial<\/a> from Digital\u00a0Ocean) around the web employ the post-commit (or other) <a href=\"https:\/\/git-scm.com\/book\/en\/v2\/Customizing-Git-Git-Hooks\">hooks<\/a> to push the code to a remote server. \u00a0While this works well, I prefer to do it differently. \u00a0I like the pull model better, where the deployment is triggered outside of git, and relies on git to fetch the code updates and run some sort of a build script, which handles database schema changes, cache resets, filesystem permissions, etc. \u00a0Such approach also allows to limit remote access to the servers (especially the production ones), and separate responsibilities of a developer and a deployer.<\/p>\n<p>With the many pull, merge, fetch, and update options that git provides, it is sometimes difficult to choose what&#8217;s the right set of commands to use. \u00a0I&#8217;ve figured it out via a rather lengthy trial-and-error process. \u00a0But if you don&#8217;t want to go through all the pain of that, here&#8217;s a <a href=\"http:\/\/grimoire.ca\/git\/stop-using-git-pull-to-deploy\">nice blog post<\/a> that tells you exactly how to do that. \u00a0I&#8217;m copy-pasting the commands here just for the future reference.<\/p>\n<pre class=\"brush: bash; light: true; title: ; notranslate\" title=\"\">\r\ncd &quot;${DEPLOY_TREE}&quot;\r\ngit fetch --all\r\ngit checkout --force &quot;${TARGET}&quot;\r\n# Following two lines only required if you use submodules\r\ngit submodule sync\r\ngit submodule update --init --recursive\r\n# Follow with actual deployment steps (run fabric\/capistrano\/make\/etc)\r\n<\/pre>\n<p>And I suggest you read <a href=\"http:\/\/grimoire.ca\/git\/stop-using-git-pull-to-deploy\">the full article<\/a> for the explanation of why this is a better way and what are some of the issues with other strategies.<\/p>\n<p>&nbsp;<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>Git is an excellent version control, but it&#8217;s more than just that. \u00a0A lot of people use it to deploy their projects as well. \u00a0Most suggestions (for example, this tutorial from Digital\u00a0Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. \u00a0While this works well, I prefer &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Deploying with git<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Deploying with git #WebDev #DevOps #SysAdmin #git","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_links_to":"","_links_to_target":""},"categories":[1,6,18,133,62,1334],"tags":[1586,2265,1330],"keyring_services":[],"class_list":["post-26154","post","type-post","status-publish","format-standard","hentry","category-general","category-linux","category-programming","category-sysadmin","category-technology","category-web-work","tag-deployment","tag-git","tag-web-development"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"Git is an excellent version control, but it&#039;s more than just that. A lot of people use it to deploy their projects as well. Most suggestions (for example, this tutorial from Digital Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. While this works well, I prefer\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Leonid Mamchenkov\"\/>\n\t<meta name=\"google-site-verification\" content=\"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Leonid Mamchenkov - Life, universe, and everything else\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Deploying with git - Leonid Mamchenkov\" \/>\n\t\t<meta property=\"og:description\" content=\"Git is an excellent version control, but it&#039;s more than just that. A lot of people use it to deploy their projects as well. Most suggestions (for example, this tutorial from Digital Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. While this works well, I prefer\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/\" \/>\n\t\t<meta property=\"og:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:secure_url\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t\t<meta property=\"og:image:height\" content=\"1024\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2016-06-03T07:10:03+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2016-06-03T07:10:03+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/MamchenkovBlog\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Deploying with git - Leonid Mamchenkov\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Git is an excellent version control, but it&#039;s more than just that. A lot of people use it to deploy their projects as well. Most suggestions (for example, this tutorial from Digital Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. While this works well, I prefer\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@mamchenkov\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#blogposting\",\"name\":\"Deploying with git - Leonid Mamchenkov\",\"headline\":\"Deploying with git\",\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"},\"datePublished\":\"2016-06-03T09:10:03+02:00\",\"dateModified\":\"2016-06-03T09:10:03+02:00\",\"inLanguage\":\"en-US\",\"commentCount\":1,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#webpage\"},\"articleSection\":\"All, Linux, Programming, Sysadmin, Technology, Web work, deployment, git, web development\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"position\":2,\"name\":\"Technology\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/linux\\\/#listItem\",\"name\":\"Linux\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/linux\\\/#listItem\",\"position\":3,\"name\":\"Linux\",\"item\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/linux\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#listItem\",\"name\":\"Deploying with git\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/#listItem\",\"name\":\"Technology\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#listItem\",\"position\":4,\"name\":\"Deploying with git\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/category\\\/technology\\\/linux\\\/#listItem\",\"name\":\"Linux\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/\",\"name\":\"Leonid Mamchenkov\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g\",\"width\":96,\"height\":96,\"caption\":\"Leonid Mamchenkov\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#webpage\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/\",\"name\":\"Deploying with git - Leonid Mamchenkov\",\"description\":\"Git is an excellent version control, but it's more than just that. A lot of people use it to deploy their projects as well. Most suggestions (for example, this tutorial from Digital Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. While this works well, I prefer\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/2016\\\/06\\\/03\\\/deploying-with-git\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/author\\\/leonid\\\/#author\"},\"datePublished\":\"2016-06-03T09:10:03+02:00\",\"dateModified\":\"2016-06-03T09:10:03+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#website\",\"url\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/\",\"name\":\"Blog of Leonid Mamchenkov\",\"description\":\"Life, universe, and everything else\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/mamchenkov.net\\\/wordpress\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Deploying with git - Leonid Mamchenkov","description":"Git is an excellent version control, but it's more than just that. A lot of people use it to deploy their projects as well. Most suggestions (for example, this tutorial from Digital Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. While this works well, I prefer","canonical_url":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"google-site-verification":"VHvdD0_usx1_4DzKy_QCVcICVgX2EgA2ybELT-wl7kQ","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#blogposting","name":"Deploying with git - Leonid Mamchenkov","headline":"Deploying with git","author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"},"image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"},"datePublished":"2016-06-03T09:10:03+02:00","dateModified":"2016-06-03T09:10:03+02:00","inLanguage":"en-US","commentCount":1,"mainEntityOfPage":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#webpage"},"isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#webpage"},"articleSection":"All, Linux, Programming, Sysadmin, Technology, Web work, deployment, git, web development"},{"@type":"BreadcrumbList","@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","position":1,"name":"Home","item":"https:\/\/mamchenkov.net\/wordpress","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","position":2,"name":"Technology","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/#listItem","name":"Linux"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/#listItem","position":3,"name":"Linux","item":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/","nextItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#listItem","name":"Deploying with git"},"previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/#listItem","name":"Technology"}},{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#listItem","position":4,"name":"Deploying with git","previousItem":{"@type":"ListItem","@id":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/#listItem","name":"Linux"}}]},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/#person","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"Person","@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author","url":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/","name":"Leonid Mamchenkov","image":{"@type":"ImageObject","@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/3cf6df002a284d78fb6e9d8222ca4d102e0832035ed6bc8447008bd234e131a4?s=96&d=identicon&r=g","width":96,"height":96,"caption":"Leonid Mamchenkov"}},{"@type":"WebPage","@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#webpage","url":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/","name":"Deploying with git - Leonid Mamchenkov","description":"Git is an excellent version control, but it's more than just that. A lot of people use it to deploy their projects as well. Most suggestions (for example, this tutorial from Digital Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. While this works well, I prefer","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#website"},"breadcrumb":{"@id":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/#breadcrumblist"},"author":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"creator":{"@id":"https:\/\/mamchenkov.net\/wordpress\/author\/leonid\/#author"},"datePublished":"2016-06-03T09:10:03+02:00","dateModified":"2016-06-03T09:10:03+02:00"},{"@type":"WebSite","@id":"https:\/\/mamchenkov.net\/wordpress\/#website","url":"https:\/\/mamchenkov.net\/wordpress\/","name":"Blog of Leonid Mamchenkov","description":"Life, universe, and everything else","inLanguage":"en-US","publisher":{"@id":"https:\/\/mamchenkov.net\/wordpress\/#person"}}]},"og:locale":"en_US","og:site_name":"Leonid Mamchenkov - Life, universe, and everything else","og:type":"article","og:title":"Deploying with git - Leonid Mamchenkov","og:description":"Git is an excellent version control, but it's more than just that. A lot of people use it to deploy their projects as well. Most suggestions (for example, this tutorial from Digital Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. While this works well, I prefer","og:url":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/","og:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:secure_url":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg","og:image:width":1024,"og:image:height":1024,"article:published_time":"2016-06-03T07:10:03+00:00","article:modified_time":"2016-06-03T07:10:03+00:00","article:publisher":"https:\/\/www.facebook.com\/MamchenkovBlog","twitter:card":"summary_large_image","twitter:site":"@mamchenkov","twitter:title":"Deploying with git - Leonid Mamchenkov","twitter:description":"Git is an excellent version control, but it's more than just that. A lot of people use it to deploy their projects as well. Most suggestions (for example, this tutorial from Digital Ocean) around the web employ the post-commit (or other) hooks to push the code to a remote server. While this works well, I prefer","twitter:creator":"@mamchenkov","twitter:image":"https:\/\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2026\/03\/leonid-sailing-beer.jpg"},"aioseo_meta_data":{"post_id":"26154","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2023-07-20 03:53:53","updated":"2026-01-15 12:11:45","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/\" title=\"Technology\">Technology<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/\" title=\"Linux\">Linux<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDeploying with git\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/mamchenkov.net\/wordpress"},{"label":"Technology","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/"},{"label":"Linux","link":"https:\/\/mamchenkov.net\/wordpress\/category\/technology\/linux\/"},{"label":"Deploying with git","link":"https:\/\/mamchenkov.net\/wordpress\/2016\/06\/03\/deploying-with-git\/"}],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":21877,"url":"https:\/\/mamchenkov.net\/wordpress\/2014\/05\/29\/gitjk-undo-what-you-just-did-in-git\/","url_meta":{"origin":26154,"position":0},"title":"gitjk &#8211; undo what you just did in git","author":"Leonid Mamchenkov","date":"May 29, 2014","format":"link","excerpt":"gitjk - undo what you just did in git. Supports the following git commands: add, archive, branch, cat-file, checkout, clone, commit, diff, fetch, grep, init, log, ls-tree, merge, mv, pull, push, remote, revert, rm, show, stash,status. Support for the following git commands is not implemented: bisect, fsck, gc, prune, rebase,\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28431,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/03\/14\/updating-wordpress-with-composer-and-wp-cli\/","url_meta":{"origin":26154,"position":1},"title":"Updating WordPress with Composer and WP-CLI","author":"Leonid Mamchenkov","date":"March 14, 2018","format":false,"excerpt":"The other day I came across this blog post by\u00a0Mark Jaquith, who is one of the lead contributors to WordPress, in which he describes his process of updating WordPress plugins with WP-CLI and Git.\u00a0 I think a lot of people these days are trying to use Git for version control\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":29090,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/12\/13\/awesome-git-addons\/","url_meta":{"origin":26154,"position":2},"title":"Awesome git addons","author":"Leonid Mamchenkov","date":"December 13, 2018","format":false,"excerpt":"Awesome git addons is yet another one of those curated awesome lists.\u00a0 This time it's for git version control tool.\u00a0 And once again, it's mind blowing. Git itself is a very flexible and powerful tool.\u00a0 But it truly amazing how far some people take it.\u00a0 In the list you can\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/git-recent.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/git-recent.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/git-recent.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/12\/git-recent.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":24504,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/07\/23\/code-sleuthing-with-git\/","url_meta":{"origin":26154,"position":3},"title":"Code Sleuthing with Git","author":"Leonid Mamchenkov","date":"July 23, 2015","format":false,"excerpt":"Code Sleuthing with Git has a handy tip for searching through git logs: [code light=\"true\"] -S <string> Look for differences that change the number of occurrences of the specified string (i.e. addition\/deletion) in a file. [\/code]","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26685,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/09\/12\/git-history-of-a-source-code-line\/","url_meta":{"origin":26154,"position":4},"title":"git: history of a source code line","author":"Leonid Mamchenkov","date":"September 12, 2016","format":false,"excerpt":"git is one of those tools that no matter how much you know about it, there is an infinite supply of new things to learn. \u00a0Here's a handy bit I've discovered recently, thanks to this StackOverflow comment: Since Git 1.8.4, git log has -L to view the evolution of a\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":18111,"url":"https:\/\/mamchenkov.net\/wordpress\/2013\/04\/29\/dandelion-incremental-git-repository-deployment\/","url_meta":{"origin":26154,"position":5},"title":"dandelion &#8211; Incremental Git repository deployment","author":"Leonid Mamchenkov","date":"April 29, 2013","format":"link","excerpt":"dandelion - Incremental Git repository deployment This might be really handy for those times when you need to push from Git to FTP\/SFTP or cloud services directly.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/26154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=26154"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/26154\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=26154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=26154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=26154"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=26154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}