Git Mailing List Archive on lore.kernel.org
 help / color / Atom feed
* Feature Suggestion: Allow to enforce "rename" in git while committing
@ 2020-02-14 21:23 Bruno Macabeus
  2020-02-14 21:38 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Bruno Macabeus @ 2020-02-14 21:23 UTC (permalink / raw)
  To: git

Hello for all,

initially I posted a question on Stack Overflow asking if is possible
to do something using Git, but seems that there is no away to do that,
and I think that it could be useful in order to improve the
organisation on logs.

My user case is:
- I'm doing a refactor on a project, migrating from JS to TS
- So I need to rename a file from index.js to index.ts (for example)
- Since the TS build steps are different, I also need to change its contents
- Sometimes I need to do so much changes that git thinks that I
removed index.js and created index.ts, but it's wrong, losing its
tracking on logs!

I should not create one commit just renaming the file and on another
commit updating its content, because the project won't build on the
first commit (since the build steps is different on a .ts file). And I
don't want to create a commit that the project can't be built on.

So I think that would be useful explicitly say to git "Hey, you should
forgot the minimum similarity threshold on this file and on this
commit. I renamed this file from index.js to index.ts. You should bind
they".

Is it make sense?

Thank you!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Feature Suggestion: Allow to enforce "rename" in git while committing
  2020-02-14 21:23 Feature Suggestion: Allow to enforce "rename" in git while committing Bruno Macabeus
@ 2020-02-14 21:38 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2020-02-14 21:38 UTC (permalink / raw)
  To: Bruno Macabeus; +Cc: git

Bruno Macabeus <bruno.macabeus@gmail.com> writes:

> I should not create one commit just renaming the file and on another
> commit updating its content, because the project won't build on the
> first commit (since the build steps is different on a .ts file). And I
> don't want to create a commit that the project can't be built on.

Even if you did the two-step renaming, comparing the end result
(i.e. HEAD) with the state before these two commits (i.e. HEAD~2,
before renaming and before editing) with "git diff HEAD~2 HEAD" will
not behave any differently if you did the renaming and modifying in
a single commit.  So it does not make much sense to split it into
two artificial steps at all.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-14 21:23 Feature Suggestion: Allow to enforce "rename" in git while committing Bruno Macabeus
2020-02-14 21:38 ` Junio C Hamano

Git Mailing List Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/git/0 git/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 git git/ https://lore.kernel.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.git


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git