1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
Henrix
  • 53
  • 9
  • Take a look at this: [How to git pretty](http://justinhileman.info/article/changing-history/). The section you might be interested in is called *Reset and re-commit*, but you have multiple options. Or actually the section right after that, using an interactive commit (and squashing). – Matt Aug 15 '17 at 12:53
  • Hi Matt, Thanks for your response! I will try that. – Henrix Aug 15 '17 at 13:05
  • @Henrix have you solve the problem yet? – Marina Liu Aug 17 '17 at 07:05

1 Answers1

0

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250