What are the best methods for git clean history?

Reading about git workflows, I wondered about the wisdom of rewriting a story. My workflow, and I think of many others, is:

  • Take the Github repository, call rep1
  • Make a fork that will rep2
  • git clone it locally to work with, rep%
  • Make changes, commit rep3
  • As soon as I finish, click on rep2 and ask others for feedback before doing PR

As I get the feedback, it seems like I would like to reinstall and crush a little, since often the feedback is insignificant things, such as rewriting comments or things that should have been different in the first place, and do not deserve their own to commit.

But from the documentation, it seems that I should not change the history to rep2, and really things like --ammend do not work in this scenario. Is my workflow wrong, or am I not understanding these warnings about changing stories?

+2
source share
2 answers

The rule about this rebaseis: you only have to rebuild your local branches , when the branch is a public branch that anyone can grab it, you should not reinstall this branch again, otherwise you can damage all other repos that have already cloned this branch.

- rebase public ( ), , , , rebase.

git pre-rebase hook, rebase

+2

: , . , -, , ; , , .

. , , , .

invidivual fork GitHub, , - . .

+5

Source: https://habr.com/ru/post/1583870/


All Articles