{"id":81393,"date":"2024-11-25T09:44:53","date_gmt":"2024-11-25T02:44:53","guid":{"rendered":"https:\/\/itviec.com\/blog\/?p=81393"},"modified":"2025-07-10T10:42:59","modified_gmt":"2025-07-10T03:42:59","slug":"cac-lenh-git-co-ban","status":"publish","type":"post","link":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/","title":{"rendered":"T\u1ed5ng h\u1ee3p 20+ c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n c\u1ea7n bi\u1ebft"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">N\u1ed9i dung b\u00e0i vi\u1ebft<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Tong_quan_ve_Git\" >T\u1ed5ng quan v\u1ec1 Git<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Chuc_nang_cua_Git\" >Ch\u1ee9c n\u0103ng c\u1ee7a Git<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Cac_lenh_Git_co_ban_de_Cau_hinh_va_khoi_tao_Repository\" >C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3\u00a0C\u1ea5u h\u00ecnh v\u00e0 kh\u1edfi t\u1ea1o Repository<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Cac_lenh_Git_co_ban_de_Quan_ly_file_va_thu_muc\" >C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Qu\u1ea3n l\u00fd file v\u00e0 th\u01b0 m\u1ee5c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Cac_lenh_Git_co_ban_de_lam_viec_voi_Branch\" >C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 l\u00e0m vi\u1ec7c v\u1edbi Branch<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Cac_lenh_Git_co_ban_de_Stage_va_Commit\" >C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Stage v\u00e0 Commit<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Cac_lenh_Git_co_ban_de_Chia_se_Repository_va_lam_viec_nhom\" >C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Chia s\u1ebb Repository v\u00e0 l\u00e0m vi\u1ec7c nh\u00f3m<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Cac_lenh_Git_co_ban_de_Kiem_tra_thay_doi_va_lich_su\" >C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Ki\u1ec3m tra thay \u0111\u1ed5i v\u00e0 l\u1ecbch s\u1eed<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Cac_lenh_Git_co_ban_de_Hoan_tac_commit\" >C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Ho\u00e0n t\u00e1c commit<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Cac_cau_hoi_thuong_gap_ve_cac_lenh_Git_co_ban\" >C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#Tong_ket_Cac_lenh_Git_co_ban\" >T\u1ed5ng k\u1ebft C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n<\/a><\/li><\/ul><\/nav><\/div>\n\n<p><em><strong>Ng\u00e0y nay, v\u1edbi kh\u1ea3 n\u0103ng cung c\u1ea5p c\u00e1c t\u00ednh n\u0103ng cho ph\u00e9p nhi\u1ec1u l\u1eadp tr\u00ecnh vi\u00ean c\u00f9ng l\u00e0m vi\u1ec7c tr\u00ean m\u1ed9t m\u00e3 ngu\u1ed3n, gi\u00fap theo d\u00f5i m\u1ecdi thay \u0111\u1ed5i \u0111\u00e3 x\u1ea3y ra v\u00e0 qu\u1ea3n l\u00fd c\u00e1c phi\u00ean b\u1ea3n, Git \u0111\u00e3 tr\u1edf th\u00e0nh m\u1ed9t c\u00f4ng c\u1ee5 c\u00f3 vai tr\u00f2 thi\u1ebft y\u1ebfu trong l\u0129nh v\u1ef1c ph\u00e1t tri\u1ec3n ph\u1ea7n m\u1ec1m. Tuy nhi\u00ean c\u00fa ph\u00e1p c\u1ee7a Git c\u00f3 th\u1ec3 s\u1ebd g\u00e2y kh\u00f3 kh\u0103n cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u, b\u00e0i vi\u1ebft n\u00e0y s\u1ebd gi\u00fap b\u1ea1n l\u00e0m quen v\u1edbi c\u00e1c l\u1ec7nh c\u01a1 b\u1ea3n th\u01b0\u1eddng d\u00f9ng trong Git, gi\u00fap qu\u00e1 tr\u00ecnh l\u00e0m vi\u1ec7c v\u1edbi m\u00e3 ngu\u1ed3n tr\u1edf n\u00ean d\u1ec5 d\u00e0ng h\u01a1n.<\/strong><\/em><\/p>\n\n\n\n<p>\u0110\u1ecdc b\u00e0i vi\u1ebft \u0111\u1ec3 hi\u1ec3u r\u00f5:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3\u00a0C\u1ea5u h\u00ecnh v\u00e0 kh\u1edfi t\u1ea1o Repository<\/li>\n\n\n\n<li>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Qu\u1ea3n l\u00fd file v\u00e0 th\u01b0 m\u1ee5c<\/li>\n\n\n\n<li>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 l\u00e0m vi\u1ec7c v\u1edbi Branch<\/li>\n\n\n\n<li>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Stage v\u00e0 Commit<\/li>\n\n\n\n<li>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Chia s\u1ebb Repository v\u00e0 l\u00e0m vi\u1ec7c nh\u00f3m<\/li>\n\n\n\n<li>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Ki\u1ec3m tra thay \u0111\u1ed5i v\u00e0 l\u1ecbch s\u1eed<\/li>\n\n\n\n<li>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Ho\u00e0n t\u00e1c commit<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-t\u1ed5ng-quan-v\u1ec1-git\"><span class=\"ez-toc-section\" id=\"Tong_quan_ve_Git\"><\/span><b>T\u1ed5ng quan v\u1ec1 Git<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Git l\u00e0 m\u1ed9t h\u1ec7 th\u1ed1ng qu\u1ea3n l\u00fd phi\u00ean b\u1ea3n ph\u00e2n t\u00e1n (Distributed Version Control System) \u0111\u01b0\u1ee3c ra m\u1eaft v\u00e0o n\u0103m 2005 b\u1edfi Linus Torvalds. Git gi\u00fap c\u00e1c l\u1eadp tr\u00ecnh vi\u00ean qu\u1ea3n l\u00fd c\u00e1c phi\u00ean b\u1ea3n c\u1ee7a m\u00e3 ngu\u1ed3n v\u00e0 theo d\u00f5i c\u00e1c thay \u0111\u1ed5i \u0111\u00e3 x\u1ea3y ra tr\u00ean \u0111\u00f3.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u1ed3ng th\u1eddi, Git cho ph\u00e9p c\u00e1c l\u1eadp tr\u00ecnh vi\u00ean c\u00f3 th\u1ec3 c\u00f9ng l\u00e0m vi\u1ec7c \u0111\u1ed3ng th\u1eddi tr\u00ean m\u1ed9t m\u00e3 ngu\u1ed3n, n\u00e2ng cao kh\u1ea3 n\u0103ng c\u1ed9ng t\u00e1c v\u00e0 hi\u1ec7u su\u1ea5t l\u00e0m vi\u1ec7c.<\/span><\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><em>\u0110\u1ecdc th\u00eam: <a href=\"https:\/\/itviec.com\/blog\/tong-quan-git-la-gi\/\" target=\"_blank\" rel=\"noopener\"><strong>Git l\u00e0 g\u00ec: \u0110\u1ecbnh ngh\u0129a, Thu\u1eadt ng\u1eef c\u01a1 b\u1ea3n v\u00e0 C\u00e1ch c\u00e0i \u0111\u1eb7t<\/strong><\/a><\/em><\/p>\n<\/blockquote>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-ch\u1ee9c-nang-c\u1ee7a-git\"><span class=\"ez-toc-section\" id=\"Chuc_nang_cua_Git\"><\/span><b>Ch\u1ee9c n\u0103ng c\u1ee7a Git<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Git \u0111\u00f3ng vai tr\u00f2 l\u01b0u tr\u1eef l\u1ecbch s\u1eed thay \u0111\u1ed5i c\u1ee7a m\u00e3 ngu\u1ed3n, bao g\u1ed3m c\u1ea3 nh\u1eefng th\u00f4ng tin chi ti\u1ebft nh\u01b0 n\u1ed9i dung thay \u0111\u1ed5i, th\u1eddi gian thay \u0111\u1ed5i v\u00e0 ng\u01b0\u1eddi \u0111\u00e3 thay \u0111\u1ed5i. \u0110\u1ed3ng th\u1eddi, l\u1eadp tr\u00ecnh vi\u00ean c\u00f3 th\u1ec3 quay tr\u1edf l\u1ea1i m\u1ed9t phi\u00ean b\u1ea3n tr\u01b0\u1edbc \u0111\u00f3 trong m\u00e3 ngu\u1ed3n m\u1ed9t c\u00e1ch nhanh ch\u00f3ng.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">M\u1ed9t \u0111i\u1ec3m n\u1ed5i b\u1eadt c\u1ee7a Git \u0111\u00f3 l\u00e0 kh\u1ea3 n\u0103ng t\u00e1ch nh\u00e1nh v\u00e0 g\u1ed9p nh\u00e1nh. L\u1eadp tr\u00ecnh vi\u00ean c\u00f3 th\u1ec3 t\u1ea1o ra m\u1ed9t nh\u00e1nh \u0111\u1ed9c l\u1eadp \u0111\u1ec3 x\u00e2y d\u1ef1ng c\u00e1c t\u00ednh n\u0103ng m\u1edbi v\u00e0 kh\u00f4ng l\u00e0m \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn m\u00e3 ngu\u1ed3n \u0111ang ch\u1ea1y \u1ed5n \u0111\u1ecbnh hi\u1ec7n t\u1ea1i. Kh\u1ea3 n\u0103ng n\u00e0y c\u00f2n gi\u00fap cho c\u00e1c th\u00e0nh vi\u00ean trong team c\u00f3 th\u1ec3 c\u00f9ng l\u00e0m vi\u1ec7c \u0111\u1ed3ng th\u1eddi tr\u00ean m\u1ed9t m\u00e3 ngu\u1ed3n v\u00e0 h\u1ee3p nh\u1ea5t c\u00e1c thay \u0111\u1ed5i c\u1ee7a t\u1eebng ng\u01b0\u1eddi m\u1ed9t c\u00e1ch d\u1ec5 d\u00e0ng.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n-d\u1ec3-c\u1ea5u-hinh-va-kh\u1edfi-t\u1ea1o-repository\"><span class=\"ez-toc-section\" id=\"Cac_lenh_Git_co_ban_de_Cau_hinh_va_khoi_tao_Repository\"><\/span><b>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3\u00a0C\u1ea5u h\u00ecnh v\u00e0 kh\u1edfi t\u1ea1o Repository<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-init\"><b>Git init<\/b><\/h3>\n\n\n\n<p><b>Git init <\/b><span style=\"font-weight: 400;\">d\u00f9ng \u0111\u1ec3 kh\u1edfi t\u1ea1o m\u1ed9t repository m\u1edbi t\u1ea1i th\u01b0 m\u1ee5c hi\u1ec7n t\u1ea1i, ch\u1ec9 c\u1ea7n ch\u1ea1y m\u1ed9t l\u1ea7n duy nh\u1ea5t l\u00fac t\u1ea1o m\u1edbi repository.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git init<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-clone\"><b>Git clone<\/b><\/h3>\n\n\n\n<p><b>Git clone <\/b><span style=\"font-weight: 400;\">t\u1ea1o ra b\u1ea3n sao l\u00e0m vi\u1ec7c c\u1ee5c b\u1ed9 c\u1ee7a m\u1ed9t repository \u1edf kho l\u01b0u tr\u1eef t\u1eeb xa th\u00f4ng qua URL, ch\u1ec9 c\u1ea7n ch\u1ea1y m\u1ed9t l\u1ea7n duy nh\u1ea5t khi ch\u01b0a c\u00f3 b\u1ea3n sao \u1edf m\u00e1y c\u1ee5c b\u1ed9.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git <\/span><span style=\"font-weight: 400;\">clone<\/span><span style=\"font-weight: 400;\"> &#91;url]<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Trong \u0111\u00f3, URL ch\u00ednh l\u00e0 \u0111\u1ecba ch\u1ec9 remote repository.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-config\"><b>Git config<\/b><\/h3>\n\n\n\n<p><b>Git config <\/b><span style=\"font-weight: 400;\">c\u00f3 ch\u1ee9c n\u0103ng d\u00f9ng \u0111\u1ec3 thi\u1ebft l\u1eadp c\u00e1c th\u00f4ng s\u1ed1 nh\u01b0 th\u00f4ng tin ng\u01b0\u1eddi d\u00f9ng, h\u00e0nh vi c\u1ee7a Git trong ph\u1ea1m vi m\u1ed9t repository ho\u1eb7c to\u00e0n b\u1ed9 repository trong m\u00e1y c\u00e1 nh\u00e2n. <\/span><b>Git config<\/b><span style=\"font-weight: 400;\"> th\u01b0\u1eddng \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng ngay sau khi c\u00e0i \u0111\u1eb7t Git, ho\u1eb7c trong tr\u01b0\u1eddng h\u1ee3p l\u00e0m vi\u1ec7c \u1edf nhi\u1ec1u repository v\u1edbi nhi\u1ec1u t\u00ean t\u00e1c gi\u1ea3 kh\u00e1c nhau.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git config &#91;--global] &lt;<\/span><i><span style=\"font-weight: 400;\">thu\u1ed9c t\u00ednh c\u1ea5u h\u00ecnh<\/span><\/i><span style=\"font-weight: 400;\">&gt; &lt;<\/span><i><span style=\"font-weight: 400;\">gi\u00e1 tr\u1ecb<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Trong \u0111\u00f3, c\u1edd <\/span><b>&#8211;global<\/b><span style=\"font-weight: 400;\"> \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 \u00e1p d\u1ee5ng c\u00e1c thi\u1ebft l\u1eadp v\u00e0o t\u1ea5t c\u1ea3 c\u00e1c repository tr\u00ean m\u00e1y t\u00ednh. N\u1ebfu kh\u00f4ng c\u00f3 c\u1edd <\/span><b>&#8211;global<\/b><span style=\"font-weight: 400;\">, c\u00e1c thi\u1ebft l\u1eadp s\u1ebd ch\u1ec9 \u00e1p d\u1ee5ng cho repository hi\u1ec7n t\u1ea1i \u0111ang \u0111\u01b0\u1ee3c thao t\u00e1c.<\/span><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-m\u1ed9t-s\u1ed1-tr\u01b0\u1eddng-h\u1ee3p-s\u1eed-d\u1ee5ng-git-config\"><strong>M\u1ed9t s\u1ed1 tr\u01b0\u1eddng h\u1ee3p s\u1eed d\u1ee5ng Git config<\/strong><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">Thi\u1ebft l\u1eadp th\u00f4ng tin ng\u01b0\u1eddi d\u00f9ng:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git config --global user.email <\/span><span style=\"font-weight: 400;\">\"example@itviec.com\"<\/span>\n<span style=\"font-weight: 400;\">git config --global user.name <\/span><span style=\"font-weight: 400;\">\"IT Viec\"<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Xem c\u00e1c c\u1ea5u h\u00ecnh hi\u1ec7n t\u1ea1i:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git config --global --list<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Thi\u1ebft l\u1eadp editor m\u1eb7c \u0111\u1ecbnh cho Git:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git config --global core.editor <\/span><span style=\"font-weight: 400;\">\"code --wait\"<\/span><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n-d\u1ec3-qu\u1ea3n-ly-file-va-th\u01b0-m\u1ee5c\"><span class=\"ez-toc-section\" id=\"Cac_lenh_Git_co_ban_de_Quan_ly_file_va_thu_muc\"><\/span><b>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 <\/b><b>Qu\u1ea3n l\u00fd file v\u00e0 th\u01b0 m\u1ee5c<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-status\"><b>Git status<\/b><\/h3>\n\n\n\n<p><b>Git status <\/b><span style=\"font-weight: 400;\">c\u00f3 ch\u1ee9c n\u0103ng hi\u1ec3n th\u1ecb tr\u1ea1ng th\u00e1i hi\u1ec7n t\u1ea1i c\u1ee7a c\u00e1c t\u1eadp tin trong khu v\u1ef1c l\u00e0m vi\u1ec7c v\u00e0 khu v\u1ef1c Staging.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git status<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u1edbi Git status, ch\u00fang ta c\u00f3 th\u1ec3 th\u1ea5y \u0111\u01b0\u1ee3c:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400;\">Nh\u1eefng t\u1eadp tin c\u00f3 s\u1ef1 thay \u0111\u1ed5i \u0111\u00e3 \u0111\u01b0\u1ee3c th\u00eam v\u00e0o Staging Area \u0111\u1ec3 chu\u1ea9n b\u1ecb commit.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">Nh\u1eefng t\u1eadp tin c\u00f3 thay \u0111\u1ed5i ho\u1eb7c b\u1ecb x\u00f3a nh\u01b0ng ch\u01b0a \u0111\u01b0\u1ee3c th\u00eam v\u00e0o Staging Area.<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">C\u00e1c t\u1eadp tin m\u1edbi \u0111\u01b0\u1ee3c t\u1ea1o nh\u01b0ng ch\u01b0a \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef trong repository (untracked).<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">Tr\u1ea1ng th\u00e1i c\u1ee7a branch hi\u1ec7n t\u1ea1i v\u00e0 c\u00e1c commit \u0111\u00e3 th\u1ef1c hi\u1ec7n.<\/span><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"674\" height=\"251\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-1-vippro.png\" alt=\"ca\u0301c le\u0323\u0302nh Git co\u031b ba\u0309n - itviec blog\" class=\"wp-image-81672\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-1-vippro.png 674w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-1-vippro-300x112.png 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-1-vippro-640x238.png 640w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-1-vippro-200x74.png 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-1-vippro-100x37.png 100w\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-add\"><b>Git add<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n commit c\u00e1c thay \u0111\u1ed5i v\u00e0o Repository, c\u00e1c thay \u0111\u1ed5i \u0111\u00f3 c\u1ea7n \u0111\u01b0\u1ee3c th\u00eam v\u00e0o khu v\u1ef1c Staging, l\u00fac \u0111\u00f3 ch\u00fang ta s\u1ebd c\u1ea7n \u0111\u1ebfn l\u1ec7nh <\/span><b>Git add<\/b><span style=\"font-weight: 400;\">.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git add &lt;<\/span><i><span style=\"font-weight: 400;\">t\u1eadp tin ho\u1eb7c th\u01b0 m\u1ee5c<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-m\u1ed9t-s\u1ed1-tr\u01b0\u1eddng-h\u1ee3p-s\u1eed-d\u1ee5ng-git-add\"><strong>M\u1ed9t s\u1ed1 tr\u01b0\u1eddng h\u1ee3p s\u1eed d\u1ee5ng Git add<\/strong><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">Th\u00eam to\u00e0n b\u1ed9 th\u01b0 m\u1ee5c:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git add folder_name\/<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Th\u00eam t\u1eadp tin c\u1ee5 th\u1ec3:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git add file_name<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Th\u00eam t\u1ea5t c\u1ea3 c\u00e1c t\u1eadp tin c\u00f3 s\u1ef1 thay \u0111\u1ed5i v\u00e0o khu v\u1ef1c Staging:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git add .<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-rm\"><b>Git rm<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <\/span><b>git rm<\/b><span style=\"font-weight: 400;\"> \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 x\u00f3a file kh\u1ecfi khu v\u1ef1c l\u00e0m vi\u1ec7c ho\u1eb7c khu v\u1ef1c Staging. Sau khi th\u1ef1c hi\u1ec7n, file b\u1ecb x\u00f3a s\u1ebd kh\u00f4ng c\u00f2n \u0111\u01b0\u1ee3c theo d\u00f5i trong repository. Tuy nhi\u00ean \u0111i\u1ec1u n\u00e0y ch\u1ec9 ho\u00e0n t\u1ea5t khi b\u1ea1n th\u1ef1c hi\u1ec7n commit thay \u0111\u1ed5i \u0111\u00f3.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git rm &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean th\u01b0 m\u1ee5c ho\u1eb7c t\u00ean file<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n-d\u1ec3-l-am-vi\u1ec7c-v\u1edbi-branch\"><span class=\"ez-toc-section\" id=\"Cac_lenh_Git_co_ban_de_lam_viec_voi_Branch\"><\/span><b>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 l<\/b><b>\u00e0m vi\u1ec7c v\u1edbi Branch<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-branch\"><b>Git branch<\/b><\/h3>\n\n\n\n<p><b>Git branch <\/b><span style=\"font-weight: 400;\">d\u00f9ng \u0111\u1ec3 qu\u1ea3n l\u00fd nh\u00e1nh trong repository. Branch l\u00e0 \u0111\u01a1n v\u1ecb \u0111\u1ec3 t\u00e1ch bi\u1ec7t c\u00f4ng vi\u1ec7c \u0111ang th\u1ef1c hi\u1ec7n, \u0111i\u1ec1u n\u00e0y gi\u00fap vi\u1ec7c ph\u00e1t tri\u1ec3n c\u00e1c t\u00ednh n\u0103ng m\u1edbi kh\u00f4ng l\u00e0m \u1ea3nh h\u01b0\u1edfng \u0111\u1ebfn branch ch\u00ednh \u0111ang ho\u1ea1t \u0111\u1ed9ng \u1ed5n \u0111\u1ecbnh.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git branch &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00f9y ch\u1ecdn<\/span><\/i><span style=\"font-weight: 400;\">&gt; &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean branch<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-m\u1ed9t-s\u1ed1-tr\u01b0\u1eddng-h\u1ee3p-s\u1eed-d\u1ee5ng-git-branch\"><strong>M\u1ed9t s\u1ed1 tr\u01b0\u1eddng h\u1ee3p s\u1eed d\u1ee5ng Git branch<\/strong><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u1edbi vi\u1ec7c k\u1ebft h\u1ee3p c\u00e1c t\u00f9y ch\u1ecdn, git branch \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng trong c\u00e1c tr\u01b0\u1eddng h\u1ee3p nh\u01b0:<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">T\u1ea1o branch m\u1edbi:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git branch &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean branch m\u1edbi<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">X\u00f3a branch:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git branch -d &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean branch<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">N\u1ebfu branch ch\u01b0a \u0111\u01b0\u1ee3c h\u1ee3p nh\u1ea5t v\u00e0o branch kh\u00e1c, b\u1ea1n c\u1ea7n s\u1eed d\u1ee5ng -D:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git branch -D &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean branch<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u1ed5i t\u00ean branch hi\u1ec7n t\u1ea1i:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git branch -m &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean m\u1edbi<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Ki\u1ec3m tra danh s\u00e1ch branch \u0111ang c\u00f3:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git branch &lt;-a | -r&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Trong \u0111\u00f3, <\/span><b>-a<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 hi\u1ec3n th\u1ecb t\u1ea5t c\u1ea3 c\u00e1c branch (\u1edf c\u1ee5c b\u1ed9 v\u00e0 kho t\u1eeb xa), <\/span><b>-r<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 hi\u1ec3n th\u1ecb c\u00e1c branch tr\u00ean kho l\u01b0u tr\u1eef t\u1eeb xa, n\u1ebfu kh\u00f4ng c\u00f3 t\u00f9y ch\u1ecdn \u0111i k\u00e8m, <\/span><b>git branch<\/b><span style=\"font-weight: 400;\"> s\u1ebd hi\u1ec3n th\u1ecb c\u00e1c branch \u1edf c\u1ee5c b\u1ed9.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-checkout\"><b>Git checkout<\/b><\/h3>\n\n\n\n<p><b>Git checkout <\/b><span style=\"font-weight: 400;\">\u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 chuy\u1ec3n \u0111\u1ed5i tr\u1ea1ng th\u00e1i l\u00e0m vi\u1ec7c gi\u1eefa c\u00e1c branches ho\u1eb7c c\u00e1c phi\u00ean b\u1ea3n.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git checkout &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean branch<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-m\u1ed9t-s\u1ed1-ch\u1ee9c-nang-khac-c\u1ee7a-git-checkout\"><strong>M\u1ed9t s\u1ed1 ch\u1ee9c n\u0103ng kh\u00e1c c\u1ee7a Git checkout<\/strong><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, b\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n m\u1ed9t s\u1ed1 ch\u1ee9c n\u0103ng kh\u00e1c khi k\u1ebft h\u1ee3p v\u1edbi c\u00e1c t\u00f9y ch\u1ecdn:<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng <\/span><b>-b <\/b><span style=\"font-weight: 400;\">\u0111\u1ec3 th\u1ef1c hi\u1ec7n \u0111\u1ed3ng th\u1eddi vi\u1ec7c t\u1ea1o branch m\u1edbi v\u00e0 chuy\u1ec3n tr\u1ea1ng th\u00e1i l\u00e0m vi\u1ec7c sang branch m\u1edbi t\u1ea1o:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git checkout -b &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean branch m\u1edbi<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng <\/span><b>&#8212;<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 kh\u00f4i ph\u1ee5c tr\u1ea1ng th\u00e1i tr\u01b0\u1edbc \u0111\u00f3 c\u1ee7a t\u1eadp tin:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git checkout -- &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean t\u1eadp tin<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Chuy\u1ec3n \u0111\u1ebfn tr\u1ea1ng th\u00e1i l\u00e0m vi\u1ec7c c\u1ee7a m\u1ed9t commit:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git checkout &lt;<\/span><i><span style=\"font-weight: 400;\">commit id<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-switch\"><b>Git switch<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u00e2y l\u00e0 m\u1ed9t l\u1ec7nh m\u1edbi \u0111\u01b0\u1ee3c b\u1ed5 sung \u1edf c\u00e1c phi\u00ean b\u1ea3n g\u1ea7n \u0111\u00e2y, n\u00f3 \u0111\u01b0\u1ee3c t\u1ea1o ra v\u1edbi ch\u1ee9c n\u0103ng chuy\u1ec3n \u0111\u1ed5i tr\u1ea1ng th\u00e1i l\u00e0m vi\u1ec7c gi\u1eefa c\u00e1c branches. \u0110i\u1ec1u n\u00e0y gi\u00fap t\u00e1ch bi\u1ec7t ch\u1ee9c n\u0103ng v\u1edbi l\u1ec7nh<\/span><b> git checkout <\/b><span style=\"font-weight: 400;\">(c\u00f3 nhi\u1ec1u t\u00e1c v\u1ee5 kh\u00e1c nh\u01b0 chuy\u1ec3n commit, kh\u00f4i ph\u1ee5c t\u1eadp tin)<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git switch &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean branch<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <\/span><b>git switch<\/b><span style=\"font-weight: 400;\"> c\u0169ng c\u00f3 t\u00f9y ch\u1ecdn \u0111\u1ec3 th\u1ef1c hi\u1ec7n \u0111\u1ed3ng th\u1eddi c\u00f4ng vi\u1ec7c t\u1ea1o branch m\u1edbi v\u00e0 chuy\u1ec3n sang branch \u0111\u00f3:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git switch -c &lt;<\/span><i><span style=\"font-weight: 400;\">t\u00ean branch<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n-d\u1ec3-stage-va-commit\"><span class=\"ez-toc-section\" id=\"Cac_lenh_Git_co_ban_de_Stage_va_Commit\"><\/span><b>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Stage v\u00e0 Commit<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-stash\"><b>Git stash<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh n\u00e0y d\u00f9ng \u0111\u1ec3 l\u01b0u tr\u1eef t\u1ea1m th\u1eddi c\u00e1c thay \u0111\u1ed5i \u0111\u00e3 \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n nh\u01b0ng ch\u01b0a \u0111\u01b0\u1ee3c commit v\u00e0 khi\u1ebfn cho khu v\u1ef1c l\u00e0m vi\u1ec7c tr\u1edf n\u00ean s\u1ea1ch s\u1ebd.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git stash<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">V\u00ed d\u1ee5:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400;\">Khu v\u1ef1c l\u00e0m vi\u1ec7c \u0111ang c\u00f3 m\u1ed9t s\u1ed1 t\u1eadp tin thay \u0111\u1ed5i:<\/span><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"635\" height=\"160\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-2-vippro.png\" alt=\"\" class=\"wp-image-81674\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-2-vippro.png 635w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-2-vippro-300x76.png 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-2-vippro-200x50.png 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-2-vippro-100x25.png 100w\" sizes=\"auto, (max-width: 635px) 100vw, 635px\" \/><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400;\">Khu v\u1ef1c l\u00e0m vi\u1ec7c sau khi s\u1eed d\u1ee5ng git stash:<\/span><\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"609\" height=\"95\" src=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-3-vippro.png\" alt=\"\" class=\"wp-image-81673\" srcset=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-3-vippro.png 609w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-3-vippro-300x47.png 300w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-3-vippro-200x31.png 200w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-3-vippro-100x16.png 100w, https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-git-co-ban-3-vippro-600x95.png 600w\" sizes=\"auto, (max-width: 609px) 100vw, 609px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-cac-cach-s\u1eed-d\u1ee5ng-git-stash\"><strong>C\u00e1c c\u00e1ch s\u1eed d\u1ee5ng Git stash<\/strong><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1eddng h\u1ee3p n\u1ebfu mu\u1ed1n kh\u00f4i ph\u1ee5c c\u00e1c thay \u0111\u1ed5i \u0111\u00e3 l\u01b0u tr\u01b0\u1edbc \u0111\u00f3, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng c\u00e1c c\u00e1ch sau:<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Kh\u00f4i ph\u1ee5c m\u1ed9t stash c\u1ee5 th\u1ec3 v\u00e0 v\u1eabn l\u01b0u tr\u1eef l\u1ea1i stash \u0111\u00f3:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git stash apply &lt;<\/span><i><span style=\"font-weight: 400;\">stash id<\/span><\/i><span style=\"font-weight: 400;\">&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Kh\u00f4i ph\u1ee5c stash m\u1edbi nh\u1ea5t v\u00e0 x\u00f3a b\u1ecf stash \u0111\u00f3:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git stash pop<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Ki\u1ec3m tra danh s\u00e1ch stash hi\u1ec7n t\u1ea1i:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git stash list<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-commit\"><b>Git commit<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh n\u00e0y s\u1ebd t\u1ea1o ra c\u00e1c commit l\u01b0u l\u1ea1i c\u00e1c thay \u0111\u1ed5i \u0111\u01b0\u1ee3c x\u1ea3y ra tr\u00ean t\u1eadp tin v\u00e0o repository. M\u1ed7i commit s\u1ebd c\u00f3 m\u1ed9t id \u0111\u1ecbnh danh duy nh\u1ea5t \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 th\u1ef1c hi\u1ec7n c\u00e1c thao t\u00e1c v\u00e0 qu\u1ea3n l\u00fd. M\u1ed7i l\u1ea7n commit, n\u00ean c\u1ea7n \u0111\u00ednh k\u00e8m m\u1ed9t n\u1ed9i dung m\u00f4 t\u1ea3 t\u1ed5ng qu\u00e1t nh\u1eefng thay \u0111\u1ed5i \u0111\u01b0\u1ee3c th\u1ef1c hi\u1ec7n trong commit.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git commit -m <\/span><span style=\"font-weight: 400;\">\"<\/span><i><span style=\"font-weight: 400;\">n\u1ed9i dung m\u00f4 t\u1ea3<\/span><\/i><span style=\"font-weight: 400;\">\"<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">M\u1ed7i commit s\u1ebd ch\u1ee9a c\u00e1c th\u00f4ng tin v\u1ec1:<\/span><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><span style=\"font-weight: 400;\">C\u00e1c thay \u0111\u1ed5i \u0111\u00e3 th\u1ef1c hi\u1ec7n<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">T\u00e1c gi\u1ea3 c\u1ee7a commit<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">Th\u1eddi gian commit<\/span><\/li>\n\n\n\n<li><span style=\"font-weight: 400;\">N\u1ed9i dung m\u00f4 t\u1ea3 c\u00e1c thay \u0111\u1ed5i<\/span><\/li>\n<\/ul>\n\n\n\n<p><span style=\"font-weight: 400;\">Tr\u01b0\u1eddng h\u1ee3p c\u1ea7n thay \u0111\u1ed5i n\u1ed9i dung c\u1ee7a m\u1ed9t commit tr\u01b0\u1edbc \u0111\u00f3, b\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n b\u1eb1ng c\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git commit -amend<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">B\u00ean c\u1ea1nh \u0111\u00f3, \u0111\u1ec3 k\u1ebft h\u1ee3p thao t\u00e1c git add v\u00e0 git commit, b\u1ea1n c\u00f3 th\u1ec3 th\u1ef1c hi\u1ec7n nh\u01b0 sau:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git commit -a -m <\/span><span style=\"font-weight: 400;\">\"n\u1ed9i dung m\u00f4 t\u1ea3\"<\/span><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n-d\u1ec3-chia-s\u1ebb-repository-va-lam-vi\u1ec7c-nhom\"><span class=\"ez-toc-section\" id=\"Cac_lenh_Git_co_ban_de_Chia_se_Repository_va_lam_viec_nhom\"><\/span><b>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Chia s\u1ebb Repository v\u00e0 l\u00e0m vi\u1ec7c nh\u00f3m<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-remote\"><b>Git remote<\/b><\/h3>\n\n\n\n<p><b>Git remote <\/b><span style=\"font-weight: 400;\">d\u00f9ng \u0111\u1ec3 k\u1ebft n\u1ed1i kho l\u01b0u tr\u1eef c\u1ee5c b\u1ed9 v\u1edbi kho l\u01b0u tr\u1eef t\u1eeb xa. Kho l\u01b0u tr\u1eef t\u1eeb xa c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c \u0111\u1eb7t t\u00ean ri\u00eang (th\u01b0\u1eddng s\u1eed d\u1ee5ng origin) \u0111\u1ec3 tr\u00e1nh ph\u1ea3i nh\u1edb URL m\u1ed7i khi th\u1ef1c hi\u1ec7n c\u00e1c thao t\u00e1c c\u00f3 li\u00ean quan.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git remote &lt;<\/span><span style=\"font-weight: 400;\">command<\/span><span style=\"font-weight: 400;\">&gt; &lt;t\u00ean b\u00ed danh&gt; &lt;remote URL&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">M\u1ed9t s\u1ed1 tr\u01b0\u1eddng h\u1ee3p s\u1eed d\u1ee5ng:<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">Th\u00eam m\u1ed9t kho l\u01b0u tr\u1eef t\u1eeb xa m\u1edbi:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git remote add origin &lt;remote url&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">X\u00f3a k\u1ebft n\u1ed1i m\u1ed9t kho l\u01b0u tr\u1eef t\u1eeb xa:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git remote remove origin<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">\u0110\u1ed5i t\u00ean b\u00ed danh c\u1ee7a kho l\u01b0u tr\u1eef t\u1eeb xa:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git remote rename origin new_name<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Hi\u1ec3n th\u1ecb danh s\u00e1ch c\u00e1c kho l\u01b0u tr\u1eef xa hi\u1ec7n c\u00f3:<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-push\"><b>Git push<\/b><\/h3>\n\n\n\n<p><b>Git push<\/b><span style=\"font-weight: 400;\"> c\u00f3 ch\u1ee9c n\u0103ng g\u1eedi c\u00e1c commit ho\u1eb7c tags \u1edf kho l\u01b0u tr\u1eef c\u1ee5c b\u1ed9 \u0111\u1ebfn kho l\u01b0u tr\u1eef t\u1eeb xa. Git push c\u1ea7n x\u00e1c \u0111\u1ecbnh 2 tham s\u1ed1 l\u00e0 t\u00ean kho l\u01b0u tr\u1eef t\u1eeb xa v\u00e0 t\u00ean branch \u0111ang th\u1ef1c hi\u1ec7n<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git push origin &lt;t\u00ean branch&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">N\u1ebfu tr\u01b0\u1eddng h\u1ee3p \u0111\u00e2y l\u00e0 l\u1ea7n \u0111\u1ea7u ti\u00ean \u0111\u1ea9y branch l\u00ean kho l\u01b0u tr\u1eef t\u1eeb xa, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <\/span><b>-u <\/b><span style=\"font-weight: 400;\">(upsteam), \u0111i\u1ec1u n\u00e0y s\u1ebd thi\u1ebft l\u1eadp branch hi\u1ec7n t\u1ea1i theo d\u00f5i branch t\u01b0\u01a1ng \u1ee9ng tr\u00ean kho l\u01b0u tr\u1eef t\u1eeb xa. Nh\u1eefng l\u1ea7n th\u1ef1c hi\u1ec7n git push sau \u0111\u00f3, b\u1ea1n kh\u00f4ng c\u1ea7n ph\u1ea3i ch\u1ec9 \u0111\u1ecbnh t\u00ean branch.<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git push -u origin &lt;t\u00ean branch&gt;<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-fetch\"><b>Git fetch<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <\/span><b>git fetch<\/b><span style=\"font-weight: 400;\"> \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 c\u1eadp nh\u1eadt t\u1ea5t c\u1ea3 c\u00e1c thay \u0111\u1ed5i m\u1edbi t\u1eeb kho l\u01b0u tr\u1eef t\u1eeb xa v\u1ec1 kho l\u01b0u tr\u1eef c\u1ee5c b\u1ed9 m\u00e0 kh\u00f4ng t\u1ef1 \u0111\u1ed9ng h\u1ee3p nh\u1ea5t ch\u00fang v\u00e0o nh\u00e1nh c\u1ee5c b\u1ed9. \u0110\u00e2y l\u00e0 m\u1ed9t l\u1ec7nh an to\u00e0n, cho ph\u00e9p b\u1ea1n ki\u1ec3m tra c\u00e1c thay \u0111\u1ed5i m\u1edbi tr\u01b0\u1edbc khi quy\u1ebft \u0111\u1ecbnh h\u1ee3p nh\u1ea5t ch\u00fang.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git fetch &lt;t\u00ean remote&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Ngo\u00e0i ra, \u0111\u1ec3 l\u1ea5y t\u1ea5t c\u1ea3 branches, tags v\u00e0 commits t\u1eeb kho l\u01b0u tr\u1eef t\u1eeb xa, b\u1ea1n c\u00f3 th\u1ec3 s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <\/span><b>&#8211;all<\/b><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git fetch --all<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-merge\"><b>Git merge<\/b><\/h3>\n\n\n\n<p><b>Git merge <\/b><span style=\"font-weight: 400;\">\u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 h\u1ee3p nh\u1ea5t c\u00e1c thay \u0111\u1ed5i t\u1eeb branch n\u00e0y sang branch kh\u00e1c. Khi h\u1ee3p nh\u1ea5t, n\u00f3 s\u1ebd \u00e1p d\u1ee5ng c\u00e1c commit c\u1ee7a branch \u0111\u01b0\u1ee3c merge v\u00e0o branch hi\u1ec7n t\u1ea1i. Tr\u01b0\u1eddng h\u1ee3p gi\u1eefa hai branch c\u00f3 m\u1ed9t s\u1ed1 commit m\u1edbi k\u1ec3 t\u1eeb l\u1ea7n t\u00e1ch branch tr\u01b0\u1edbc \u0111\u00f3, l\u1ec7nh merge s\u1ebd t\u1ea1o ra m\u1ed9t commit h\u1ee3p nh\u1ea5t ghi l\u1ea1i n\u1ed9i dung k\u1ebft h\u1ee3p gi\u1eefa hai branch.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git merge &lt;t\u00ean branch&gt;<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-rebase\"><b>Git rebase<\/b><\/h3>\n\n\n\n<p><b>Git rebase <\/b><span style=\"font-weight: 400;\">c\u00f3 ch\u1ee9c n\u0103ng t\u01b0\u01a1ng t\u1ef1 nh\u01b0 Git merge, d\u00f9ng \u0111\u1ec3 h\u1ee3p nh\u1ea5t c\u00e1c thay \u0111\u1ed5i t\u1eeb branch n\u00e0y sang branch hi\u1ec7n t\u1ea1i. Tuy nhi\u00ean, kh\u00e1c v\u1edbi git merge, git rebase s\u1ebd l\u1ea5y t\u1ea5t c\u1ea3 commit t\u1eeb branch \u0111\u01b0\u1ee3c merge ch\u00e8n l\u00ean \u0111\u1ea7u trong danh s\u00e1ch commit c\u1ee7a branch hi\u1ec7n t\u1ea1i v\u00e0 kh\u00f4ng t\u1ea1o ra commit h\u1ee3p nh\u1ea5t.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git rebase &lt;t\u00ean branch&gt;<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-pull\"><b>Git pull<\/b><\/h3>\n\n\n\n<p><b>Git pull <\/b><span style=\"font-weight: 400;\">s\u1ebd l\u1ea5y v\u1ec1 t\u1ea5t c\u1ea3 thay \u0111\u1ed5i t\u1eeb kho l\u01b0u tr\u1eef t\u1eeb xa v\u00e0 h\u1ee3p nh\u1ea5t ch\u00fang v\u00e0o branch hi\u1ec7n t\u1ea1i, hay n\u00f3i c\u00e1ch kh\u00e1c, <\/span><b>git pull<\/b><span style=\"font-weight: 400;\"> ch\u00ednh l\u00e0 s\u1ef1 k\u1ebft h\u1ee3p gi\u1eefa <\/span><b>git fetch<\/b><span style=\"font-weight: 400;\"> v\u00e0 <\/span><b>git merge.<\/b><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git pull &lt;t\u00ean remote&gt; &lt;t\u00ean branch&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Tuy nhi\u00ean, b\u1ea1n c\u00f3 th\u1ec3 thay th\u1ebf vi\u1ec7c s\u1eed d\u1ee5ng <\/span><b>git merge<\/b><span style=\"font-weight: 400;\"> b\u1eb1ng <\/span><b>git rebase<\/b><span style=\"font-weight: 400;\"> trong l\u1ec7nh <\/span><b>git pull<\/b><span style=\"font-weight: 400;\"> b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng t\u00f9y ch\u1ecdn <\/span><b>&#8211;rebase<\/b><span style=\"font-weight: 400;\"> (ho\u1eb7c vi\u1ebft t\u1eaft l\u00e0 <\/span><b>-r<\/b><span style=\"font-weight: 400;\">):<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git pull -r &lt;t\u00ean remote&gt; &lt;t\u00ean branch&gt;<\/span><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n-d\u1ec3-ki\u1ec3m-tra-thay-d\u1ed5i-va-l\u1ecbch-s\u1eed\"><span class=\"ez-toc-section\" id=\"Cac_lenh_Git_co_ban_de_Kiem_tra_thay_doi_va_lich_su\"><\/span><b>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Ki\u1ec3m tra thay \u0111\u1ed5i v\u00e0 l\u1ecbch s\u1eed<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-log\"><b>Git log<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh d\u00f9ng \u0111\u1ec3 hi\u1ec3n th\u1ecb to\u00e0n b\u1ed9 l\u1ecbch s\u1eed commit theo th\u1ee9 t\u1ef1 th\u1eddi gian c\u1ee7a m\u1ed9t repository. \u0110i\u1ec1u n\u00e0y gi\u00fap cung c\u1ea5p b\u1ed1i c\u1ea3nh v\u00e0 l\u1ecbch s\u1eed c\u1ee7a m\u1ed9t repository.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git <\/span><span style=\"font-weight: 400;\">log<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-diff\"><b>Git diff<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh <\/span><b>git diff <\/b><span style=\"font-weight: 400;\">\u0111\u01b0\u1ee3c d\u00f9ng \u0111\u1ec3 so s\u00e1nh s\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa c\u00e1c phi\u00ean b\u1ea3n kh\u00e1c nhau c\u1ee7a repository.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git diff &lt;t\u00f9y ch\u1ecdn&gt;<\/span><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"h-tr\u01b0\u1eddng-h\u1ee3p-s\u1eed-d\u1ee5ng-git-diff\"><strong>Tr\u01b0\u1eddng h\u1ee3p s\u1eed d\u1ee5ng Git diff<\/strong><\/h4>\n\n\n\n<p><span style=\"font-weight: 400;\">So s\u00e1nh kh\u00e1c bi\u1ec7t gi\u1eefa 2 commit<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git diff &lt;commit id 1&gt; &lt;commit id 2&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">So s\u00e1nh kh\u00e1c bi\u1ec7t gi\u1eefa c\u00e1c t\u1eadp tin trong khu v\u1ef1c Staging v\u00e0 phi\u00ean b\u1ea3n \u0111\u00e3 \u0111\u01b0\u1ee3c commit tr\u01b0\u1edbc \u0111\u00f3.<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git diff --staged<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">So s\u00e1nh kh\u00e1c bi\u1ec7t gi\u1eefa hai branches<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git diff &lt;branch 1&gt; &lt;branch 2&gt;<\/span><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n-d\u1ec3-hoan-tac-commit\"><span class=\"ez-toc-section\" id=\"Cac_lenh_Git_co_ban_de_Hoan_tac_commit\"><\/span><b>C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n \u0111\u1ec3 Ho\u00e0n t\u00e1c commit<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-revert\"><b>Git revert<\/b><\/h3>\n\n\n\n<p><b>Git revert <\/b><span style=\"font-weight: 400;\">c\u00f3 ch\u1ee9c n\u0103ng t\u1ea1o ra m\u1ed9t commit \u0111\u1ed1i l\u1eadp v\u1edbi commit \u0111\u01b0\u1ee3c ch\u1ecdn, gi\u00fap ho\u00e0n t\u00e1c c\u00e1c thay \u0111\u1ed5i \u0111\u00e3 l\u01b0u v\u00e0o repository m\u1ed9t c\u00e1c d\u1ec5 d\u00e0ng. \u0110\u1eb7c \u0111i\u1ec3m c\u1ee7a git revert l\u00e0 nh\u1eefng commit \u0111\u01b0\u1ee3c revert v\u1eabn \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef trong repository v\u00e0 l\u1ecbch s\u1eed commit kh\u00f4ng b\u1ecb x\u00e1o tr\u1ed9n.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git revert &lt;commit id&gt;<\/span><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-git-reset\"><b>Git reset<\/b><\/h3>\n\n\n\n<p><b>Git reset <\/b><span style=\"font-weight: 400;\">\u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 lo\u1ea1i b\u1ecf commit \u0111\u00e3 \u0111\u01b0\u1ee3c l\u01b0u v\u00e0o repository v\u00e0 x\u00f3a b\u1ecf ch\u00fang kh\u1ecfi l\u1ecbch s\u1eed commit.<\/span><\/p>\n\n\n\n<p><span style=\"font-weight: 400;\">C\u00fa ph\u00e1p:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git reset &lt;t\u00f9y ch\u1ecdn&gt; &lt;commit id&gt;<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">Trong \u0111\u00f3, c\u00f3 ba t\u00f9y ch\u1ecdn \u0111\u1ec3 th\u1ef1c hi\u1ec7n reset bao g\u1ed3m:<\/span><\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><span style=\"font-weight: 400;\">&#8211;<\/span><b>-hard<\/b><span style=\"font-weight: 400;\">: ph\u00e1 v\u1ee1 commit v\u00e0 x\u00f3a b\u1ecf n\u1ed9i dung thay \u0111\u1ed5i c\u1ee7a c\u00e1c t\u1eadp tin<\/span><\/li>\n\n\n\n<li><b>&#8211;soft<\/b><span style=\"font-weight: 400;\">: ph\u00e1 v\u1ee1 commit v\u00e0 \u0111\u01b0a c\u00e1c thay \u0111\u1ed5i v\u1ec1 khu v\u1ef1c Staging<\/span><\/li>\n\n\n\n<li><b>&#8211;mixed<\/b><span style=\"font-weight: 400;\">: ph\u00e1 v\u1ee1 commit v\u00e0 \u0111\u01b0a c\u00e1c thay \u0111\u1ed5i v\u1ec1 khu v\u1ef1c l\u00e0m vi\u1ec7c<\/span><\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-cac-cau-h\u1ecfi-th\u01b0\u1eddng-g\u1eb7p-v\u1ec1-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n\"><span class=\"ez-toc-section\" id=\"Cac_cau_hoi_thuong_gap_ve_cac_lenh_Git_co_ban\"><\/span><b>C\u00e1c c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p v\u1ec1 c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-t\u1ea1i-sao-c\u1ea7n-s\u1eed-d\u1ee5ng-git-add-tr\u01b0\u1edbc-khi-th\u1ef1c-hi\u1ec7n-commit\"><b>T\u1ea1i sao c\u1ea7n s\u1eed d\u1ee5ng git add tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n commit?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">Vi\u1ec7c th\u1ef1c hi\u1ec7n l\u1ec7nh git add tr\u01b0\u1edbc khi th\u1ef1c hi\u1ec7n commit \u0111\u01b0\u1ee3c xem nh\u01b0 l\u00e0 m\u1ed9t h\u00e0nh \u0111\u1ed9ng ti\u00ean quy\u1ebft. Khi s\u1eed d\u1ee5ng git add, b\u1ea1n c\u00f3 th\u1ec3 ki\u1ec3m so\u00e1t \u0111\u01b0\u1ee3c nh\u1eefng thay \u0111\u1ed5i n\u00e0o s\u1ebd \u0111\u01b0\u1ee3c l\u01b0u trong m\u1ed9t commit, nh\u1eefng thay \u0111\u1ed5i n\u00e0o kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p l\u01b0u v\u00e0o repository. \u0110i\u1ec1u n\u00e0y gi\u00fap b\u1ea1n ki\u1ec3m so\u00e1t \u0111\u01b0\u1ee3c n\u1ed9i dung c\u1ee7a commit v\u00e0 tr\u00e1nh r\u1ee7i ro x\u1ea3y ra s\u1ef1 c\u1ed1.<\/span><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-l\u1ec7nh-revert-va-l\u1ec7nh-reset-khac-nhau-nh\u01b0-th\u1ebf-nao\"><b>L\u1ec7nh revert v\u00e0 l\u1ec7nh reset kh\u00e1c nhau nh\u01b0 th\u1ebf n\u00e0o?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u1ec7nh revert v\u00e0 reset \u0111\u1ec1u c\u00f3 kh\u1ea3 n\u0103ng ho\u00e0n t\u00e1c c\u00e1c thay \u0111\u1ed5i \u0111\u00e3 \u0111\u01b0\u1ee3c commit, tuy nhi\u00ean ch\u00fang c\u00f3 h\u00e0nh vi ho\u00e0n to\u00e0n kh\u00e1c nhau:<\/span><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><span style=\"font-weight: 400;\">Ti\u00eau ch\u00ed<\/span><\/td><td><span style=\"font-weight: 400;\">Git revert<\/span><\/td><td><span style=\"font-weight: 400;\">Git reset<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">H\u00e0nh \u0111\u1ed9ng<\/span><\/td><td><span style=\"font-weight: 400;\">T\u1ea1o ra m\u1ed9t commit v\u1edbi n\u1ed9i dung \u0111\u1ed1i l\u1eadp v\u1edbi commit \u0111\u01b0\u1ee3c revert<\/span><\/td><td><span style=\"font-weight: 400;\">Lo\u1ea1i b\u1ecf commit kh\u1ecfi kho l\u01b0u tr\u1eef v\u00e0 \u0111\u01b0a c\u00e1c thay \u0111\u1ed5i tr\u1edf l\u1ea1i khu v\u1ef1c l\u00e0m vi\u1ec7c<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">L\u01b0u l\u1ea1i l\u1ecbch s\u1eed<\/span><\/td><td><span style=\"font-weight: 400;\">Commit \u0111\u01b0\u1ee3c revert v\u1eabn c\u00f2n l\u01b0u trong l\u1ecbch s\u1eed commit<\/span><\/td><td><span style=\"font-weight: 400;\">Commit \u0111\u01b0\u1ee3c reset s\u1ebd kh\u00f4ng c\u00f2n d\u1ea5u v\u1ebft trong l\u1ecbch s\u1eed commit<\/span><\/td><\/tr><tr><td><span style=\"font-weight: 400;\">\u0110\u1ed9 an to\u00e0n<\/span><\/td><td><span style=\"font-weight: 400;\">N\u1ebfu commit \u0111\u01b0\u1ee3c revert \u0111\u00e3 \u0111\u01b0\u1ee3c \u0111\u1ea9y l\u00ean remote repository, vi\u1ec7c s\u1eed d\u1ee5ng revert s\u1ebd gi\u1ea3m thi\u1ec3u kh\u1ea3 n\u0103ng b\u1ecb xung \u0111\u1ed9t branch v\u00e0 tr\u00e1nh thi\u1ebfu s\u00f3t d\u1eef li\u1ec7u<\/span><\/td><td><span style=\"font-weight: 400;\">Reset s\u1ebd l\u00e0m thay \u0111\u1ed5i l\u1ecbch s\u1eed commit, v\u00ec v\u1eady c\u00f3 th\u1ec3 x\u1ea3y ra xung \u0111\u1ed9t \u0111\u1ed1i v\u1edbi c\u00e1c l\u1eadp tr\u00ecnh vi\u00ean c\u00f9ng c\u1ed9ng t\u00e1c kh\u00e1c<\/span><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-lam-sao-d\u1ec3-thay-d\u1ed5i-ten-tac-gi\u1ea3-c\u1ee7a-commit\"><b>L\u00e0m sao \u0111\u1ec3 thay \u0111\u1ed5i t\u00ean t\u00e1c gi\u1ea3 c\u1ee7a commit?<\/b><\/h3>\n\n\n\n<p><span style=\"font-weight: 400;\">S\u1eed d\u1ee5ng l\u1ec7nh <\/span><b>git commit &#8211;amend<\/b><span style=\"font-weight: 400;\"> k\u00e8m theo t\u00f9y ch\u1ecdn <\/span><b>author<\/b><span style=\"font-weight: 400;\"> \u0111\u1ec3 thay \u0111\u1ed5i n\u1ed9i dung c\u1ee7a m\u1ed9t commit. V\u00ed d\u1ee5:<\/span><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span style=\"font-weight: 400;\">git commit --amend --author=<\/span><span style=\"font-weight: 400;\">\"T\u00ean M\u1edbi &lt;email@example.com&gt;\"<\/span><\/code><\/pre>\n\n\n\n<p><span style=\"font-weight: 400;\">L\u00fac n\u00e0y terminal s\u1ebd m\u1edf ra m\u1ed9t c\u1eeda s\u1ed5 so\u1ea1n th\u1ea3o ch\u1ee9a c\u00e1c th\u00f4ng tin c\u1ee7a commit, n\u1ebfu b\u1ea1n kh\u00f4ng mu\u1ed1n ch\u1ec9nh s\u1eeda th\u00f4ng tin kh\u00e1c, c\u00f3 th\u1ec3 l\u01b0u v\u00e0 tho\u00e1t kh\u1ecfi tr\u00ecnh so\u1ea1n th\u1ea3o.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-t\u1ed5ng-k\u1ebft-cac-l\u1ec7nh-git-c\u01a1-b\u1ea3n\"><span class=\"ez-toc-section\" id=\"Tong_ket_Cac_lenh_Git_co_ban\"><\/span><b>T\u1ed5ng k\u1ebft C\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n<\/b><span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><span style=\"font-weight: 400;\">Git l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 qu\u1ea3n l\u00fd m\u00e3 ngu\u1ed3n m\u1ea1nh m\u1ebd v\u00e0 ph\u1ed5 bi\u1ebfn b\u1eadc nh\u1ea5t hi\u1ec7n nay. Tuy nhi\u00ean c\u00fa ph\u00e1p c\u1ee7a n\u00f3 c\u00f3 th\u1ec3 g\u00e2y kh\u00f3 kh\u0103n cho ng\u01b0\u1eddi m\u1edbi b\u1eaft \u0111\u1ea7u. Th\u00f4ng qua b\u00e0i vi\u1ebft n\u00e0y, ITviec hi v\u1ecdng b\u1ea1n c\u00f3 th\u1ec3 n\u1eafm \u0111\u01b0\u1ee3c c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n th\u01b0\u1eddng s\u1eed d\u1ee5ng, t\u1eeb \u0111\u00f3 t\u1ea1o b\u01b0\u1edbc \u0111\u1ec7m v\u1eefng ch\u1eafc \u0111\u1ec3 ti\u1ebfp t\u1ee5c chinh ph\u1ee5c n\u00f3, m\u1edf ra c\u01a1 h\u1ed9i th\u0103ng ti\u1ebfn trong ngh\u1ec1 nghi\u1ec7p.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ng\u00e0y nay, v\u1edbi kh\u1ea3 n\u0103ng cung c\u1ea5p c\u00e1c t\u00ednh n\u0103ng cho ph\u00e9p nhi\u1ec1u l\u1eadp tr\u00ecnh vi\u00ean c\u00f9ng l\u00e0m vi\u1ec7c tr\u00ean m\u1ed9t m\u00e3 ngu\u1ed3n, gi\u00fap theo d\u00f5i m\u1ecdi thay \u0111\u1ed5i \u0111\u00e3 x\u1ea3y ra v\u00e0 qu\u1ea3n l\u00fd c\u00e1c phi\u00ean b\u1ea3n, Git \u0111\u00e3 tr\u1edf th\u00e0nh m\u1ed9t c\u00f4ng c\u1ee5 c\u00f3 vai tr\u00f2 thi\u1ebft y\u1ebfu trong l\u0129nh v\u1ef1c ph\u00e1t tri\u1ec3n [&hellip;]<\/p>\n","protected":false},"author":235,"featured_media":81671,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_gspb_post_css":"","footnotes":""},"categories":[109],"tags":[],"class_list":["post-81393","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-chuyen-mon-it"],"blocksy_meta":[],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v27.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>T\u1ed5ng h\u1ee3p 20+ c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n c\u1ea7n bi\u1ebft - ITviec Blog<\/title>\n<meta name=\"description\" content=\"L\u01b0u ngay c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n th\u01b0\u1eddng s\u1eed d\u1ee5ng, h\u01b0\u1edbng d\u1eabn chi ti\u1ebft c\u00e1ch d\u00f9ng theo t\u1eebng tr\u01b0\u1eddng h\u1ee3p c\u1ee5 th\u1ec3 v\u00e0 v\u00ed d\u1ee5 minh h\u1ecda.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"T\u1ed5ng h\u1ee3p 20+ c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n c\u1ea7n bi\u1ebft\" \/>\n<meta property=\"og:description\" content=\"Ng\u00e0y nay, v\u1edbi kh\u1ea3 n\u0103ng cung c\u1ea5p c\u00e1c t\u00ednh n\u0103ng cho ph\u00e9p nhi\u1ec1u l\u1eadp tr\u00ecnh vi\u00ean c\u00f9ng l\u00e0m vi\u1ec7c tr\u00ean m\u1ed9t m\u00e3 ngu\u1ed3n, gi\u00fap theo d\u00f5i m\u1ecdi thay \u0111\u1ed5i \u0111\u00e3 x\u1ea3y ra v\u00e0 qu\u1ea3n\" \/>\n<meta property=\"og:url\" content=\"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/\" \/>\n<meta property=\"og:site_name\" content=\"ITviec Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ITviec\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-25T02:44:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-10T03:42:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-Git-co-ban-vippro.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1500\" \/>\n\t<meta property=\"og:image:height\" content=\"790\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Ph\u1ea1m H\u1eefu Ng\u1ecdc\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ITviec\" \/>\n<meta name=\"twitter:site\" content=\"@ITviec\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ph\u1ea1m H\u1eefu Ng\u1ecdc\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"16 ph\u00fat\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"T\u1ed5ng h\u1ee3p 20+ c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n c\u1ea7n bi\u1ebft - ITviec Blog","description":"L\u01b0u ngay c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n th\u01b0\u1eddng s\u1eed d\u1ee5ng, h\u01b0\u1edbng d\u1eabn chi ti\u1ebft c\u00e1ch d\u00f9ng theo t\u1eebng tr\u01b0\u1eddng h\u1ee3p c\u1ee5 th\u1ec3 v\u00e0 v\u00ed d\u1ee5 minh h\u1ecda.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/","og_locale":"vi_VN","og_type":"article","og_title":"T\u1ed5ng h\u1ee3p 20+ c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n c\u1ea7n bi\u1ebft","og_description":"Ng\u00e0y nay, v\u1edbi kh\u1ea3 n\u0103ng cung c\u1ea5p c\u00e1c t\u00ednh n\u0103ng cho ph\u00e9p nhi\u1ec1u l\u1eadp tr\u00ecnh vi\u00ean c\u00f9ng l\u00e0m vi\u1ec7c tr\u00ean m\u1ed9t m\u00e3 ngu\u1ed3n, gi\u00fap theo d\u00f5i m\u1ecdi thay \u0111\u1ed5i \u0111\u00e3 x\u1ea3y ra v\u00e0 qu\u1ea3n","og_url":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/","og_site_name":"ITviec Blog","article_publisher":"https:\/\/www.facebook.com\/ITviec","article_published_time":"2024-11-25T02:44:53+00:00","article_modified_time":"2025-07-10T03:42:59+00:00","og_image":[{"width":1500,"height":790,"url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-Git-co-ban-vippro.jpg","type":"image\/jpeg"}],"author":"Ph\u1ea1m H\u1eefu Ng\u1ecdc","twitter_card":"summary_large_image","twitter_creator":"@ITviec","twitter_site":"@ITviec","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Ph\u1ea1m H\u1eefu Ng\u1ecdc","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"16 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#article","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/"},"author":{"name":"Ph\u1ea1m H\u1eefu Ng\u1ecdc","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/407769a7625b7f955cef615f7a99abad"},"headline":"T\u1ed5ng h\u1ee3p 20+ c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n c\u1ea7n bi\u1ebft","datePublished":"2024-11-25T02:44:53+00:00","dateModified":"2025-07-10T03:42:59+00:00","mainEntityOfPage":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/"},"wordCount":3881,"publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"image":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-Git-co-ban-vippro.jpg","articleSection":["Chuy\u00ean m\u00f4n IT"],"inLanguage":"vi"},{"@type":"WebPage","@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/","url":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/","name":"T\u1ed5ng h\u1ee3p 20+ c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n c\u1ea7n bi\u1ebft - ITviec Blog","isPartOf":{"@id":"https:\/\/itviec.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#primaryimage"},"image":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#primaryimage"},"thumbnailUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-Git-co-ban-vippro.jpg","datePublished":"2024-11-25T02:44:53+00:00","dateModified":"2025-07-10T03:42:59+00:00","description":"L\u01b0u ngay c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n th\u01b0\u1eddng s\u1eed d\u1ee5ng, h\u01b0\u1edbng d\u1eabn chi ti\u1ebft c\u00e1ch d\u00f9ng theo t\u1eebng tr\u01b0\u1eddng h\u1ee3p c\u1ee5 th\u1ec3 v\u00e0 v\u00ed d\u1ee5 minh h\u1ecda.","breadcrumb":{"@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#primaryimage","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-Git-co-ban-vippro.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/11\/cac-lenh-Git-co-ban-vippro.jpg","width":1500,"height":790,"caption":"ca\u0301c le\u0323\u0302nh Git co\u031b ba\u0309n - itviec blog"},{"@type":"BreadcrumbList","@id":"https:\/\/itviec.com\/blog\/cac-lenh-git-co-ban\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Chuy\u00ean m\u00f4n IT","item":"https:\/\/itviec.com\/blog\/chuyen-mon-it\/"},{"@type":"ListItem","position":2,"name":"T\u1ed5ng h\u1ee3p 20+ c\u00e1c l\u1ec7nh Git c\u01a1 b\u1ea3n c\u1ea7n bi\u1ebft"}]},{"@type":"WebSite","@id":"https:\/\/itviec.com\/blog\/#website","url":"https:\/\/itviec.com\/blog\/","name":"ITviec Blog","description":"IT Jobs &amp; People in Vietnam","publisher":{"@id":"https:\/\/itviec.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/itviec.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/itviec.com\/blog\/#organization","name":"ITviec","url":"https:\/\/itviec.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2018\/12\/itviec-black-square-facebook.png","width":1800,"height":1800,"caption":"ITviec"},"image":{"@id":"https:\/\/itviec.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/ITviec","https:\/\/x.com\/ITviec","https:\/\/www.linkedin.com\/company\/itviec","https:\/\/www.youtube.com\/channel\/UCYthAQ3bcGr57M_ag5gHDvQ"]},{"@type":"Person","@id":"https:\/\/itviec.com\/blog\/#\/schema\/person\/407769a7625b7f955cef615f7a99abad","name":"Ph\u1ea1m H\u1eefu Ng\u1ecdc","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Pham-Huu-Ngoc-technical-content-reviewer-e1712135841473-100x100.jpg","url":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Pham-Huu-Ngoc-technical-content-reviewer-e1712135841473-100x100.jpg","contentUrl":"https:\/\/itviec.com\/blog\/wp-content\/uploads\/2024\/03\/Pham-Huu-Ngoc-technical-content-reviewer-e1712135841473-100x100.jpg","caption":"Ph\u1ea1m H\u1eefu Ng\u1ecdc"},"url":"https:\/\/itviec.com\/blog\/author\/pham-huu-ngoc-2\/"}]}},"_links":{"self":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/81393","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/users\/235"}],"replies":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/comments?post=81393"}],"version-history":[{"count":2,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/81393\/revisions"}],"predecessor-version":[{"id":89224,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/posts\/81393\/revisions\/89224"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media\/81671"}],"wp:attachment":[{"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/media?parent=81393"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/categories?post=81393"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itviec.com\/blog\/wp-json\/wp\/v2\/tags?post=81393"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}