TungNT (Blue)

tungnt.blue@gmail.com

User Tools

Site Tools


development:system:git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
development:system:git [2024/08/12 10:42] tungntdevelopment:system:git [2024/08/15 09:03] (current) tungnt
Line 51: Line 51:
 Identity added: /var/root/.ssh/id_rsa_nguyentung (/var/root/.ssh/id_rsa_nguyentung) Identity added: /var/root/.ssh/id_rsa_nguyentung (/var/root/.ssh/id_rsa_nguyentung)
 $ ssh-add -l $ ssh-add -l
-4096 SHA256:HntA0FUgaD0ELTaHSU/h0SfTAKVPkJ9xEjnP6aXyCvM /var/root/.ssh/id_rsa_tungntblue (RSA) +4096 SHA256:HntA0FUgaD0***EjnP6aXyCvM /var/root/.ssh/id_rsa_tungntblue (RSA) 
-4096 SHA256:2cJDMSnLCJPnd6K4cIdjmI58FwJ/X7u4Wrml4S8ulHw /var/root/.ssh/id_rsa_nguyentung (RSA)+4096 SHA256:2cJDMSnLCJP***Wrml4S8ulHw /var/root/.ssh/id_rsa_nguyentung (RSA)
 </code> </code>
  
Line 62: Line 62:
      
 ssh-add /var/root/.ssh/id_rsa_tungntblue ssh-add /var/root/.ssh/id_rsa_tungntblue
-ssh-add /var/root/.ssh/id_rsa_tungnt9pay 
 ssh-add /var/root/.ssh/id_rsa_nguyentung ssh-add /var/root/.ssh/id_rsa_nguyentung
  
Line 345: Line 344:
 To github.com:1sitevn/gitflow.git To github.com:1sitevn/gitflow.git
  - [deleted]         hotfixs  - [deleted]         hotfixs
 +</code>
 +
 +====== Git Rebase & Git Merge ======
 +
 +{{ :development:system:git-merge-vs-rebase.png |}}
 +
 +<code bash>
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git branch
 +  develop
 +* main
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout -b test1
 +Switched to a new branch 'test1'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout -b test2
 +Switched to a new branch 'test2'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test1
 +Switched to branch 'test1'
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % touch t1.md
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git commit -m 'T1'
 +[test1 d4dd238] T1
 + 1 file changed, 0 insertions(+), 0 deletions(-)
 + create mode 100644 t1.md
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline
 +d4dd238 (HEAD -> test1) T1
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % touch t2.md       
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .         
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git commit -m 'T2'
 +[test1 cfeb1a6] T2
 + 1 file changed, 0 insertions(+), 0 deletions(-)
 + create mode 100644 t2.md
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % touch t3.md       
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .         
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git commit -m 'T3'
 +[test1 a371709] T3
 + 1 file changed, 0 insertions(+), 0 deletions(-)
 + create mode 100644 t3.md
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline 
 +a371709 (HEAD -> test1) T3
 +cfeb1a6 T2
 +d4dd238 T1
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout -b test2
 +Switched to a new branch 'test2'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline    
 +a371709 (HEAD -> test2, test1) T3
 +cfeb1a6 T2
 +d4dd238 T1
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % echo 'Update T1' >> t1.md
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .                
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git commit -m 'T4'       
 +[test2 ab9eacf] T4
 + 1 file changed, 1 insertion(+)
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline        
 +ab9eacf (HEAD -> test2) T4
 +a371709 (test1) T3
 +cfeb1a6 T2
 +d4dd238 T1
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test1
 +Switched to branch 'test1'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % cat t1.md 
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % echo 'Update T5' >> t1.md
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .                
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git commit -m 'T5'       
 +[test1 54f6b26] T5
 + 1 file changed, 1 insertion(+)
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline        
 +54f6b26 (HEAD -> test1) T5
 +a371709 T3
 +cfeb1a6 T2
 +d4dd238 T1
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % echo 'Update T6' >> t2.md
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .                
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git commit -m 'T6'       
 +[test1 6e2e921] T6
 + 1 file changed, 1 insertion(+)
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline        
 +6e2e921 (HEAD -> test1) T6
 +54f6b26 T5
 +a371709 T3
 +cfeb1a6 T2
 +d4dd238 T1
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test2
 +Switched to branch 'test2'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % echo 'Update T7' >> t3.md
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .                
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git commit -m 'T7'       
 +[test2 d3eae48] T7
 + 1 file changed, 1 insertion(+)
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline        
 +d3eae48 (HEAD -> test2) T7
 +ab9eacf T4
 +a371709 T3
 +cfeb1a6 T2
 +d4dd238 T1
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git branch
 +  develop
 +  main
 +  test1
 +* test2
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout -b test2_bk
 +Switched to a new branch 'test2_bk'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test1
 +Switched to branch 'test1'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout -b test1_bk
 +Switched to a new branch 'test1_bk'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git branch
 +  develop
 +  main
 +  test1
 +* test1_bk
 +  test2
 +  test2_bk
 +  
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test1
 +Switched to branch 'test1'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git merge test2      
 +Auto-merging t1.md
 +CONFLICT (content): Merge conflict in t1.md
 +Automatic merge failed; fix conflicts and then commit the result.
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git commit -m 'merge for test1 from test2'
 +[test1 dec26bf] merge for test1 from test2
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline                         
 +dec26bf (HEAD -> test1) merge for test1 from test2
 +d3eae48 (test2_bk, test2) T7
 +6e2e921 (test1_bk) T6
 +54f6b26 T5
 +ab9eacf T4
 +a371709 T3
 +cfeb1a6 T2
 +d4dd238 T1
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git branch
 +  develop
 +  main
 +* test1
 +  test1_bk
 +  test2
 +  test2_bk
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test1_bk
 +Switched to branch 'test1_bk'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git branch -D test1
 +Deleted branch test1 (was dec26bf).
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout -b test1
 +Switched to a new branch 'test1'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git branch -D test2  
 +Deleted branch test2 (was d3eae48).
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test2_bk
 +Switched to branch 'test2_bk'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout -b test2
 +Switched to a new branch 'test2'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test1
 +Switched to branch 'test1'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git branch
 +  develop
 +  main
 +* test1
 +  test1_bk
 +  test2
 +  test2_bk
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git rebase test2
 +Auto-merging t1.md
 +CONFLICT (content): Merge conflict in t1.md
 +error: could not apply 54f6b26... T5
 +hint: Resolve all conflicts manually, mark them as resolved with
 +hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
 +hint: You can instead skip this commit: run "git rebase --skip".
 +hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
 +Could not apply 54f6b26... T5
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git rebase --continue
 +[detached HEAD e245d41] T5 - Version 2
 + 1 file changed, 1 insertion(+)
 +Successfully rebased and updated refs/heads/test1.
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline    
 +a16f04e (HEAD -> test1) T6
 +e245d41 T5 - Version 2
 +d3eae48 (test2_bk, test2) T7
 +ab9eacf T4
 +a371709 T3
 +cfeb1a6 T2
 +d4dd238 T1
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git checkout test2_bk
 +Switched to branch 'test2_bk'
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git rebase test1_bk  
 +Auto-merging t1.md
 +CONFLICT (content): Merge conflict in t1.md
 +error: could not apply ab9eacf... T4
 +hint: Resolve all conflicts manually, mark them as resolved with
 +hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
 +hint: You can instead skip this commit: run "git rebase --skip".
 +hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
 +Could not apply ab9eacf... T4
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git add .            
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git rebase --continue
 +[detached HEAD eec7eb5] T4 - Version 2
 + 1 file changed, 1 insertion(+)
 +Successfully rebased and updated refs/heads/test2_bk.
 +tungnt@MacBook-Pro-cua-Nguyen-2 gitflow % git log --oneline                                
 +e4d0fc8 (HEAD -> test2_bk) T7
 +eec7eb5 T4 - Version 2
 +6e2e921 (test1_bk) T6
 +54f6b26 T5
 +a371709 T3
 +cfeb1a6 T2
 +d4dd238 T1  
 +</code>
 +
 +  * git merge: khi xem log các commit sẽ được sắp xếp theo thời gian commit, dùng khi dự án ít người cùng làm.
 +  * git rebase: khi xem log các commit sẽ không sắp xếp theo thời gian commit như git merge, mà sẽ ưu tiên commit của cá nhân lên đầu. Nên sử dụng khi dự án có nhiều người cùng làm.
 +
 +====== Git Log ======
 +
 +https://git-scm.com/book/id/v2/Git-Basics-Viewing-the-Commit-History
 +
 +<code bash>
 +% git log --oneline 
 +
 +% git log -- filename modules/core/app/Http/Controllers/ExampleController.php
 +% git log -p -- filename modules/core/app/Http/Controllers/ExampleController.php
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 api.9s.vn % git log --pretty=format:"%h - %ae, %ar : %s : %cn" --since="2024-01-01"  --no-merges --author=tungnt -- filename modules/core/app/Http/Controllers/ExampleController.php
 +56e4d7fe03 - tungnt.blue@gmail.com, 3 months ago : Payout hold with MC : tungnt
 +b668bd133d - tungnt.blue@gmail.com, 5 months ago : Test TCB VA Key : tungnt
 +54327213ec - tungnt.blue@gmail.com, 5 months ago : Test TCB : tungnt
 +50db75fa85 - tungnt.blue@gmail.com, 5 months ago : Test TCB : tungnt
 +ae02e78fb4 - tungnt.blue@gmail.com, 5 months ago : Test TCB : tungnt
 +eaae3faa6f - tungnt.blue@gmail.com, 5 months ago : Test TCB : tungnt
 +7656495fc8 - tungnt.blue@gmail.com, 5 months ago : Update Payout config : tungnt
 +b0ffc56c41 - tungnt.blue@gmail.com, 6 months ago : Test key : tungnt
 +1958516401 - tungnt.blue@gmail.com, 6 months ago : Update SMS BIDV 8600664888 : tungnt
 +6ecef6fb81 - tungnt.blue@gmail.com, 6 months ago : D : tungnt
 +cd02aafff4 - tungnt.blue@gmail.com, 7 months ago : Debug : tungnt
 +2dcbc9cdb7 - tungnt.blue@gmail.com, 7 months ago : Golive jira_5001 : tungnt
 +7dae86672a - tungnt.blue@gmail.com, 7 months ago : MSB VA : tungnt
 +7974263273 - tungnt.blue@gmail.com, 7 months ago : Update name TiktokLive to Tiktok : tungnt
 +
 +tungnt@MacBook-Pro-cua-Nguyen-2 api.9s.vn % git show 54327213ec
 +commit 54327213ec68b3e8e75194653a60bb95f9f09e5a
 +Author: tungnt <tungnt.blue@gmail.com>
 +Date:   Tue Mar 12 16:44:03 2024 +0700
 +
 +    Test TCB
 +
 +diff --git a/modules/core/app/Http/Controllers/ExampleController.php b/modules/core/app/Http/Controllers/ExampleController.php
 +index 9b98620801..1bbac43c4c 100644
 +--- a/modules/core/app/Http/Controllers/ExampleController.php
 ++++ b/modules/core/app/Http/Controllers/ExampleController.php
 +@@ -47,11 +47,11 @@ class ExampleController extends BaseController
 + 
 +             $aesPlaintTextHash = hash('sha256', $aesPlaintText, true);
 +     
 +-            $sign1 = $this->sign($aesPlaintTextHash, storage_path('credentials/rsa/transfer/techcombank/2024/tcb2024/1pay_cks_1.jks'), '***');
 +-            $sign2 = $this->sign($aesPlaintTextHash, storage_path('credentials/rsa/transfer/techcombank/2024/tcb2024/1pay_cks_2.jks'), '***');
 ++            $sign1 = $this->sign($aesPlaintTextHash, storage_path('credentials/rsa/transfer/techcombank/2024/1pay_cks_1.jks'), '***');
 ++            $sign2 = $this->sign($aesPlaintTextHash, storage_path('credentials/rsa/transfer/techcombank/2024/1pay_cks_2.jks'), '***');
 +     
 +-            $verify1 = $this->verify($aesPlaintTextHash, $sign1, storage_path('credentials/rsa/transfer/techcombank/2024/tcb2024/1pay_tcb_verify_sign_1.cer'));
 +-            $verify2 = $this->verify($aesPlaintTextHash, $sign2, storage_path('credentials/rsa/transfer/techcombank/2024/tcb2024/1pay_tcb_verify_sign_2.cer'));
 ++            $verify1 = $this->verify($aesPlaintTextHash, $sign1, storage_path('credentials/rsa/transfer/techcombank/2024/1pay_tcb_verify_sign_1.cer'));
 ++            $verify2 = $this->verify($aesPlaintTextHash, $sign2, storage_path('credentials/rsa/transfer/techcombank/2024/1pay_tcb_verify_sign_2.cer'));
 +     
 +             dd($aesPlaintText, $sign1, $sign2, $verify1, $verify2);
 +         }
 </code> </code>
  
development/system/git.1723459341.txt.gz · Last modified: 2024/08/12 10:42 by tungnt

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki