2022年8月30日 星期二

How can I merge multiple commits onto another branch as a single squashed commit 2022

 https://stackoverflow.com/questions/5308816/how-can-i-merge-multiple-commits-onto-another-branch-as-a-single-squashed-commit


                                         15 Answers

29

Suppose you worked in feature/task1 with multiple commits.

  1. Go to your project branch (project/my_project)

     git checkout project/my_project
    
  2. Create a new branch (feature/task1_bugfix)

     git checkout -b feature/task1_bugfix
    
  3. Merge with the --squash option

     git merge --squash feature/task1
    
  4. Create a single commit

     git commit -am "add single comments"
    
  5. Push your branch

     git push --set-upstream origin feature/task1_bugfix
    

沒有留言:

張貼留言

2025 My Hardware Personal Computer Used

 2025 My Hardware Personal Computer Used Check Ubunut sudo dmidecode -t 2 sudo lsblk -o NAME,FSTYPE,LABEL,MOUNTPOINT,SIZE,MODEL 2025 Intel(R...