Git rebase / merge for public releases

I dug git merge and rebase in the docs, and something didn't sink. I am actively working on a project in Git, and I need to share specific milestones with other developers. I want to split the code exactly the same as at every stage / release, but not all of my small commits leading to each version.

How to create a release branch that displays the development branch, where commits in the release branch contain several commits from the development branch? In other words, the release branch should have a concise history, but otherwise corresponds to the development branch.

Initially, I thought that using a separate branch and using git merge --squash would be effective by creating a new branch with a series of commits that reflect the full set of changes between each version. Now I understand that git merge --squash does not work for reuse.

Git rebase will work to collapse multiple commits into one big commit, but since it changes the commit history, won't it change my personal history as well as public releases?

I don’t want to lose my history of small changes, but I want to push combined commits to a shared server.

+5
source share
2 answers

, , ? , git archive .

, , . , , , . , git; , .

, , () , . - , .

, , (release) (private), , , , .

# Low-level plumbing command to switch branches without checking anything out
# (Note: it doesn't matter if this branch hasn't yet been created.)
git symbolic-ref HEAD refs/heads/release

# Create a new commit based on the current index in the release branch
git commit -m "Public release commit"

# Switch back to the private branch
git checkout private

( -), - .

+7

. . .

:

git co -b release_branch_squash release_branch_with_all_commits

git rebase last_release_tag

, . , . . git .

git rebase --interactive last_release_tag

vim. , pick squash. . .

+2

All Articles