Skip to content

Instantly share code, notes, and snippets.

@savepong
Last active August 29, 2018 08:50
Show Gist options
  • Save savepong/cfdbf81f3fd3b253818079e7a48c054b to your computer and use it in GitHub Desktop.
Save savepong/cfdbf81f3fd3b253818079e7a48c054b to your computer and use it in GitHub Desktop.
รวมคำสั่งสำหรับ Git Workflow
Feature branch
// ถ้าเราอยู่ใน develop แล้วก็สั่ง
git checkout -b feature/hello-world
// หรือถ้าอยู่ branch อื่นๆ ก็พิมพ์ตามคำสั่งด้านล่าง
git checkout -b feature/hello-world develop
—————————————————————————
Release branch
// ถ้าเราอยู่ใน develop แล้วก็สั่ง
git checkout -b realease/release-0.2
// หรือถ้าอยู่ branch อื่นๆ ก็พิมพ์ตามคำสั่งด้านล่าง
git checkout -b realease/release-0.2 develop
เมื่อทำเสร็จ
// เปลี่ยนไปอยู่ master ก่อน
git checkout master
// ทำการ merge โค้ดเข้าไปใน master
git merge --no-ff release/release-0.2
// ติดเลขเวอร์ชั่นเพื่อเตือนความจำ
git tag -a 0.2
// เปลี่ยนไป develop
git checkout develop
// ทำการ merge โค้ดเข้าไปใน develop
git merge --no-ff release/release-0.2
// merge เสร็จก็ลบมันทิ้งจะได้ไม่เปลื่องและรก
git branch -d release/release-0.2
—————————————————————————
Hotfix branch
// ถ้าเราอยู่ใน master แล้วก็สั่ง
git checkout -b hotfix/create-post-error-0.2.1
// หรือถ้าอยู่ branch อื่นๆ ก็พิมพ์ตามคำสั่งด้านล่าง
git checkout -b hotfix/create-post-error-0.2.1 master
// เปลี่ยนไปอยู่ master ก่อน
git checkout master
// ทำการ merge โค้ดเข้าไปใน master
git merge --no-ff hotfix/create-post-error-0.2.1
// ติดเลขเวอร์ชั่นเพื่อเตือนความจำ
git tag -a 0.2.1
// เปลี่ยนไป develop
git checkout develop
// ทำการ merge โค้ดเข้าไปใน develop
git merge --no-ff hotfix/create-post-error-0.2.1
// merge เสร็จก็ลบมันทิ้งจะได้ไม่เปลื่องและรก
git branch -d hotfix/create-post-error-0.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment