0

1 つのかなり小さなプロジェクトのリポジトリは、200 メガバイト以上を占めます。履歴は次のようになります。

...
1) regular commit
2) regular commit
3) commit which adds 100mb of useless files + does something useful
4) regular commit
5) commit which removes all of the useless files
6) regular commit
...

リポジトリのサイズを縮小したい。また、コミットの有用な変更3が失われてはなりません。コミットを組み合わせてリモート リポジトリの 1 つにする方法はあり3ます5か?

4

1 に答える 1

2

You can use interactive rebase with the command:

git rebase -i

and write a rebase plan similar to this:

  • pick commit 1
  • pick commit 2
  • pick commit 3
  • squash commit 5
  • pick commit 4
  • pick commit 6
  • ....

After the sucessfull rebase you can force-push the modified branch:

git push -f

Be aware that rewriting a part of the history that has already been pushed may force other users to perform a rebase on the new history and to deal with the possible conflicts.

于 2013-10-24T16:17:12.090 に答える