Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

181
Visualizações
git mv in VSCode does not update typescript / javascript import paths

I want to move a typescript file in VSCode such that:

  1. Git acknowledges the file continuity.
  2. VSCode updates the parent files' import statements.

I can achieve either, but not both.

Using git mv: VSCode doesn't update the parent files' import statements.

Using manual drag & drop: git regards this as a new file.

How can I do both?

almost 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

After doing more research, it turns out git does not actually track file renames.

Compare:

After using git mv, your git status will return something like:

renamed: someFileName.ts -> newFileName.ts

After using mv, your git status will return something like:

deleted:    someFileName.ts
untracked:  newFileName.ts

^despite the apparent acknowledgement of a rename, git handles both scenarios identically.

After running git add -- someFileName.ts newFileName.ts, you will get the same:

renamed: someFileName.ts -> newFileName.ts

Interestingly, this is not the norm for most SCMs. Linus explains the design decision here.

So to answer the original question: Use the VSCode integrated file explorer for file moves/renames - this updates import paths AND there is no detriment to version control.

almost 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda