0Pricing
Git Advanced: Monorepo, Submodules & Workflows · บทเรียน

การแตกแขนงสำหรับฟีเจอร์และการแก้ไขเร่งด่วน

นำกลยุทธ์การแตกแขนงสำหรับฟีเจอร์ไปใช้อย่างมีประสิทธิภาพ และเรียนรู้วิธีนำการแก้ไขเร่งด่วนไปใช้กับระบบจริงได้อย่างรวดเร็ว

การแตกแขนงสำหรับฟีเจอร์และการแก้ไขเร่งด่วน เป็นบทเรียน Git Advanced: Monorepo, Submodules & Workflows ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Git Advanced: Monorepo, Submodules & Workflows และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Git Advanced: Monorepo, Submodules & Workflows มีบทเรียนทั้งหมด 4 บทเรียน

บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ

Why Feature Branches?

When working on new features or major changes, it's best to keep them separate from your main codebase. This is where feature branching comes in!

It allows developers to work on new functionality in isolation without affecting the stable version of the project. This prevents half-finished work from breaking the main branch.

Creating a Feature Branch

To start a new feature, you'll create a new branch from your main development line, often main or develop. This creates a separate timeline for your work.

Use the git checkout -b command to create a new branch and switch to it in one go.

git checkout -b my-new-feature

Working in Isolation

Once on your feature branch, you can make changes, add files, and commit as usual. Your commits will only exist on this branch, not on main.

It's good practice to push your feature branch to the remote repository regularly, especially if you're collaborating or want a backup.

git add . 
git commit -m "Implement initial feature UI" 
git push origin my-new-feature

Merging a Feature Branch

After your feature is complete, reviewed, and tested, it's time to integrate it back into the main development branch. You'll switch to the target branch (e.g., main) and then merge your feature branch.

Git will combine the changes. Often, a merge commit is created, showing exactly when the feature was integrated.

git checkout main 
git merge my-new-feature

Cleaning Up Feature Branches

Once a feature branch has been merged and is no longer needed, it's good practice to delete it. This keeps your list of branches tidy and easier to manage.

Remember to delete both the local and remote versions of the branch.

git branch -d my-new-feature 
git push origin --delete my-new-feature

Urgent Fixes: Hotfixes

Sometimes, critical bugs appear in the production environment that need immediate attention. These are called hotfixes.

A hotfix workflow allows you to quickly fix the issue and deploy it, minimizing downtime, without waiting for the next planned feature release.

Branching for a Hotfix

Unlike feature branches, hotfixes are typically branched directly from the production-ready branch (e.g., main or master). This ensures you're fixing the exact code currently in production.

You create a new branch specifically for the hotfix, often named with a prefix like hotfix/.

git checkout main 
git checkout -b hotfix/critical-bug-2023-01

Fix, Commit, Test

On your hotfix branch, you'll apply the necessary changes to resolve the bug. Keep the fix as small and focused as possible to reduce risk.

After making changes, commit them with a clear message and thoroughly test the fix to ensure it solves the problem without introducing new ones.

git add . 
git commit -m "HOTFIX: Fix login issue on production" 
// Run tests here

Deploying & Integrating Hotfixes

Once the hotfix is verified, it needs to be merged back into the production branch (e.g., main) and immediately deployed.

Crucially, the hotfix also needs to be merged into your long-running development branch (e.g., develop) to prevent the bug from reappearing in future releases.

git checkout main 
git merge hotfix/critical-bug-2023-01 
git push origin main 

git checkout develop 
git merge hotfix/critical-bug-2023-01 
git push origin develop

Feature vs. Hotfix Check

You've learned about feature branching and hotfixes. Let's test your understanding!

Summary: Branching for Success

In this lesson, you mastered two essential Git branching strategies:

  • Feature Branching: Ideal for developing new features in isolation, ensuring a stable main codebase. You learned to create, work on, merge, and delete feature branches.
  • Hotfixes: Crucial for quickly addressing critical bugs in production. You saw how to create hotfix branches from production, apply fixes, and merge them back to both production and development lines.

These techniques are vital for managing complex projects and maintaining a smooth development workflow with your team.

คำถามที่พบบ่อย

บทเรียน “การแตกแขนงสำหรับฟีเจอร์และการแก้ไขเร่งด่วน” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “การแตกแขนงสำหรับฟีเจอร์และการแก้ไขเร่งด่วน” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Git Advanced: Monorepo, Submodules & Workflows ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Git Advanced: Monorepo, Submodules & Workflows มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “การแตกแขนงสำหรับฟีเจอร์และการแก้ไขเร่งด่วน”

นำกลยุทธ์การแตกแขนงสำหรับฟีเจอร์ไปใช้อย่างมีประสิทธิภาพ และเรียนรู้วิธีนำการแก้ไขเร่งด่วนไปใช้กับระบบจริงได้อย่างรวดเร็ว คุณปฏิบัติ Git Advanced: Monorepo, Submodules & Workflows ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Git Advanced: Monorepo, Submodules & Workflows หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Git Advanced: Monorepo, Submodules & Workflows บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน

บทเรียน “การแตกแขนงสำหรับฟีเจอร์และการแก้ไขเร่งด่วน” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Git Advanced: Monorepo, Submodules & Workflows นี้ได้ไหม

ได้ บทเรียน Git Advanced: Monorepo, Submodules & Workflows ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. Git Flow เทียบกับ GitHub Flow
  2. GitLab Flow และการจัดการรุ่นซอฟต์แวร์
  3. การแตกแขนงสำหรับฟีเจอร์และการแก้ไขเร่งด่วน
  4. การพัฒนาแบบยึดลำต้นและการผสานรวมอย่างต่อเนื่อง
← กลับไปที่ Git Advanced: Monorepo, Submodules & Workflows