← Back to Git Course | Chapter 9: CI/CD & DevOps | Lesson 4 of 5

Git Deployment Workflows

एक deployment workflow एक moving walkway है जो आपके saved code को हाथ से carrying के बिना पूरी तरह live website तक ले जाती है।
Syntax
bash
git push remote_name branch_name
rsync -avz -e ssh ./build_dir/ user@server:/path/to/app/

एक Deployment Workflow क्या है?

एक deployment workflow वह automated pipeline है जो आपकी repository से एक commit को पूरी तरह एक चल रहे production server तक ले जाता है, manual file copying या commands चलाने को एक repeatable, auditable process से replace करते हुए।

उदाहरण: What is a Deployment Workflow?

bash
git push origin main
# triggers automated build and deploy

SSH के through Deploy करना

SSH पर deploy करने का मतलब है कि आपका CI job एक private key से authenticate होता है, आपके server से connect होता है, और updated files सीधे copy करता है (अक्सर rsync या scp के through) — एक straightforward option जब आप खुद server control करते हों और आपको एक managed platform का extra tooling न चाहिए।

उदाहरण: Deploying via SSH

bash
rsync -avz -e ssh ./dist/ user@server:/var/www/app/

Cloud Providers पर Deploy करना

Vercel, Netlify, या AWS Amplify जैसे platforms सीधे आपकी GitHub repository से connect होते हैं और एक चुनी हुई branch पर हर push पर automatically redeploy करते हैं, build, hosting, और rollback machinery आपके लिए handle करते हुए — कोई custom deploy script नहीं चाहिए।

उदाहरण: Deploying to Cloud Providers

bash
git push origin main
# Vercel/Netlify auto-deploys on push

Environment-Specific Branches

Branches को environments से map करना — dev एक sandbox में deploy करती है, staging एक pre-production copy में, main live site पर — का मतलब है कि किसी branch में merge करना खुद deploy trigger है, और कोई गलत जगह merge करके गलती से unfinished काम ship नहीं कर सकता।

उदाहरण: Environment-Specific Branches

bash
git checkout -b staging
git push origin staging

Deployments को Rollback करना

एक rollback टूटी हुई commit की जगह एक पिछली, known-good commit को फिर से deploy करता है — आमतौर पर history force-push करने के बजाय एक पहले वाले commit hash के against deploy workflow फिर से चलाकर, जो क्या हुआ इसकी real timeline intact रखता है।

उदाहरण: Rolling Back Deployments

bash
git checkout a1b2c3d
# re-deploy this known-good commit
Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. pipeline के बजाय directly एक local machine से deploy करना, ताकि जो चल रहा है वह main से match न करे।
  2. SSH private key को CI secrets के बजाय repository में store करना।
  3. किसी भी branch पर हर push पर deploy करना, जबकि सिर्फ main या tagged releases को production तक पहुँचना चाहिए।
🔒

Chapter Quiz — Complete all 5 topics to unlock

0/5 topics done

Complete these topics first:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.