github - Git 感觉无用/多余的 commit 状态可以删掉吗 ?
世界只因有你
世界只因有你 2017-05-02 09:22:25
0
6
807

Git 还不怎么熟 , 我想问下 .
历史提交的commit , 如果以后这个项目目录太大 , 可以把一些历史状态删掉吗 ?

这样可以节省很多空间

世界只因有你
世界只因有你

reply all(6)
我想大声告诉你
  1. Submissions that have been uploaded to the server, whether reset or rebase, will be rejected by teammates;
  2. Excessive submissions will only record the changes. If they are all positive modifications, they will not increase the size, but are the recommended best practice strategies;
  3. When you have permission to reset the server, you just force your local and server to jump to the corresponding submission; your teammates are still at the original position, and the result of them updating and submitting again will be very dramatic;
  4. Rebase is good for your local and server in this case; your teammates will scold you and create a new branch for me, which is not beautiful at all. At the same time, the redundancy of local submissions has really increased. ..
巴扎黑
git rebase -i
为情所困

Yes, you can find it just by searching

git reset --hard <commit_id>

git push origin HEAD --force


But I really don’t recommend doing this.

大家讲道理

@AlexChen has already said to do it through the reset command:

 git reset --hard <SOME-COMMIT>

The effect of this command is to undo all commits after this commit. You can also do it through the revert command:

git revert <SOME-COMMIT>

The effect is to cancel a certain submission.
This is indeed very risky, so be careful.

PHPzhong

In my impression, the rebase command can merge redundant commits

http://www.ruanyifeng.com/blog/2015/08/git-use-process.html
Refer to this article

仅有的幸福

means git commit just save file changes, so it won’t take up much space

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template