jasonmccreary / git-trim

MIT License
367 stars 10 forks source link

Question about how to use #11

Closed jamesmills closed 2 years ago

jamesmills commented 2 years ago

‪Should you checkout the master/develop branch and run this on those rather than on a feature branch? I’m assuming so? Is it possible to output a message/warning to the user to remind them of this?

jasonmccreary commented 2 years ago

Behavior is very contextual based on the options you use. So it depends.

The fundamental thing to remember is git trim will never remove the current branch. Furthermore, options like --merge, use the current branch to determine the state of other branches, i.e. is the branch merged into the current branch.

To try and answer your specific question, I would say, yes, in most cases you would likely want to run git trim from your primary branch (e.g. master or main).

Since you mentioned develop, if you have multiple branches you would never want to remove, check out the new configuration.