Difference between revisions of "Git/squash"
< Git
Jump to navigation
Jump to search
(Created page with "==Notes== Squashing seems to involve something like this: # Create new branch from master $ git checkout -b squash-feature # squash the commits from featu...") |
|||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Notes== | ==Notes== | ||
− | Squashing seems to involve something like this: | + | Squashing seems to involve something like this (not yet tested): |
− | # Create new branch from master | + | # Create new branch from master and switch to it |
− | $ | + | $ git {{l/same|checkout}} -b {{arg|squash-branch}} |
# squash the commits from feature into your squash branch | # squash the commits from feature into your squash branch | ||
− | $ | + | $ git {{l/same|read-tree}} -m -u {{arg|source-branch}} |
+ | |||
+ | # commit and push to origin | ||
+ | $ git commit | ||
+ | $ git {{l/same|push}} origin {{arg|squash-branch}} --set-upstream | ||
+ | |||
+ | Where: | ||
+ | * {{arg|squash-branch}} is the temporary branch into which you are doing the squashing | ||
+ | * {{arg|source-branch}} is the name of the branch you're squashing [from]. |
Latest revision as of 15:20, 12 November 2018
Notes
Squashing seems to involve something like this (not yet tested):
# Create new branch from master and switch to it $ git checkout -b <squash-branch> # squash the commits from feature into your squash branch $ git read-tree -m -u <source-branch>
# commit and push to origin $ git commit $ git push origin <squash-branch> --set-upstream
Where:
- <squash-branch> is the temporary branch into which you are doing the squashing
- <source-branch> is the name of the branch you're squashing [from].