Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in DevOps and Agile by (29.3k points)

I've moved a file manually and then I've modified it. According to Git, it is a new file and a removed file. Is there any way to force Git into treating it as a file move?

1 Answer

0 votes
by (50.2k points)

Git will automatically detect the modifications. you need to Just git add the new file and git rm the old file. git status will then show whether it has detected the rename.

For moves around directories, you may need to:

cd 

git add -A .

Run git status to check that the "new file" is now a "renamed" file

If git status still shows "new file" and not "renamed" you need to move the file and then you need to modify it in separate commands.

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 13, 2019 in DevOps and Agile by chandra (29.3k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...