{"thread":{"id":"52806","subject":"Feature Suggestion: Allow to enforce \"rename\" in git while committing","startedAt":"2020-02-14T21:23:32Z","lastAt":"2020-02-14T21:38:13Z","messageCount":2,"participants":["Bruno Macabeus","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"391799","messageId":"CANnkH-ViK9qySZGi=xbcE4YDiskhLxDsH21DMxTEHi6=X0EZuQ@mail.gmail.com","threadId":"52806","inReplyTo":null,"subject":"Feature Suggestion: Allow to enforce \"rename\" in git while committing","fromName":"Bruno Macabeus","fromEmail":"bruno.macabeus@gmail.com","sentAt":"2020-02-14T21:23:18Z","receivedAt":"2020-02-14T21:23:32Z","isPatch":false,"sender":{"key":"bruno.macabeus@gmail.com","avatar":null},"body":"Hello for all,\n\ninitially I posted a question on Stack Overflow asking if is possible\nto do something using Git, but seems that there is no away to do that,\nand I think that it could be useful in order to improve the\norganisation on logs.\n\nMy user case is:\n- I'm doing a refactor on a project, migrating from JS to TS\n- So I need to rename a file from index.js to index.ts (for example)\n- Since the TS build steps are different, I also need to change its contents\n- Sometimes I need to do so much changes that git thinks that I\nremoved index.js and created index.ts, but it's wrong, losing its\ntracking on logs!\n\nI should not create one commit just renaming the file and on another\ncommit updating its content, because the project won't build on the\nfirst commit (since the build steps is different on a .ts file). And I\ndon't want to create a commit that the project can't be built on.\n\nSo I think that would be useful explicitly say to git \"Hey, you should\nforgot the minimum similarity threshold on this file and on this\ncommit. I renamed this file from index.js to index.ts. You should bind\nthey\".\n\nIs it make sense?\n\nThank you!\n"},{"id":"391800","messageId":"xmqqa75konnj.fsf@gitster-ct.c.googlers.com","threadId":"52806","inReplyTo":"CANnkH-ViK9qySZGi=xbcE4YDiskhLxDsH21DMxTEHi6=X0EZuQ@mail.gmail.com","subject":"Re: Feature Suggestion: Allow to enforce \"rename\" in git while committing","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-02-14T21:38:08Z","receivedAt":"2020-02-14T21:38:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bruno Macabeus <bruno.macabeus@gmail.com> writes:\n\n> I should not create one commit just renaming the file and on another\n> commit updating its content, because the project won't build on the\n> first commit (since the build steps is different on a .ts file). And I\n> don't want to create a commit that the project can't be built on.\n\nEven if you did the two-step renaming, comparing the end result\n(i.e. HEAD) with the state before these two commits (i.e. HEAD~2,\nbefore renaming and before editing) with \"git diff HEAD~2 HEAD\" will\nnot behave any differently if you did the renaming and modifying in\na single commit.  So it does not make much sense to split it into\ntwo artificial steps at all.\n\n\n"}]}