Git - click on the new remote with a single consolidated lock

I have been working on a private repo for some time and am going to release on GitHub.

The problem is that I have a lot of commits, and for the sake of hygiene, I want only one commit to appear on GitHub.

How can I click without clicking history? ie consolidate the entire MASTER into a single commit

Thank you very much in advance.

Arc

+5
source share
2 answers

Commonly used git rebase --interactive HEAD~nwhere n is not. of which you want to merge into one. However, in your case, you want to dump the whole story into a single commit, and since rebooting without a parent (before the initial commit) is impossible, we must use git resetand git commit --amend.

Here is what you do:

  • git log --oneline. SHA .
  • , SHA fe7d5d1. git reset fe7d5d1. reset .
  • git add ., .
  • inital commit, git commit --amend -m "Initial commit".
  • , git log --oneline.

. //, .

+5

git rebase. .

+1

All Articles