Search code examples
gitgithubcommitgit-commit

Not to commit previous commits, I want just to add a commit that takes all the other changes made on the other branch I merged?


I want to get the changes but not to publish all those commits that I did on the test branch ... What I want is that after merging, taking those changes and committing (once) on the master, not to publish all those commits.

Thanks

I haven't tried anything because I want to be sure about what to do. Then I will push again.

git merge test
git status

Your branch is ahead of 'origin/master' by 6 commits


Solution

  • You could squash your commits, but I tend to prefer the simplicity of recommitting. I post the solution here for those interested :

    git checkout test
    git reset --soft origin/master
    git commit -m "message for this whole feature"
    git push origin HEAD
    

    Then the test-branch will be pushed to the remote, and your merge request test > master will feature only the one commit made above.