How to use git merge --squash?

后端 未结 13 1712
夕颜
夕颜 2020-11-22 05:41

I have a remote Git server, here is the scenario which I want to perform:

  • For each bug/feature I create a different Git branch

  • I keep on com

13条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 06:04

    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. Marge 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
      

提交回复
热议问题