Git push but with following conditions

Viewed 25

I have the following requirement.

Git repo A (on BitBucket): all development is committed multiple times a day Git repo B (on AWS CodeCommit): only specific commits from Repo A should go into it...

Example: I work on a block of code (have multiple commits into Repo A) and then when I'm happy with the progress and unit testing..etc.. I want to push all the changes into Repo B as a single commit (similar to a merge)

This is to keep the commit history of Repo B clean

1 Answers

I would seperate branches for repo A and B. Then i would develop only on A-related branches. When ready to push on B, I would git cherry-pick new commits from A-pushed-branch to B-related branch, and use git rebase --interactive to squash those to one commit and also adjust commit message. Important to cherry-pick, do not try to merge because differing branches history would not allow to procede.

Then just push it.

A lot of manual work thoe.

Related