简体   繁体   中英

Git: Push differences between two branches of different repos as a single commit to another repo

I made a fork of my public Github repo on a private Gitlab repo. I made several commits in a single branch of the fork and want to push all these changes (differences between public repo branch and private repo branch) as a single commit to the public repo branch on GitHub again. I only want to use the command line.

Does anybody know how to do this?
I think it's something with git squash.

See my old answer " In git, what is the difference between merge --squash and rebase ? "

You can make another branch in your private repo, merge --squash your fix branch on it, and push that new branch composed of a single commit.

git checkout -b newBranch origin/master
git merge --squash my_fix_branch
git push -u origin newBranch

From your remote private repo on GitHub, you can make a pull request from that new pushed branch, to merge that single commit back into the original repo.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM