Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

172
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!