Avatar of Robert Saylor
Robert Saylor
Flag for United States of America asked on

Git question

I moved a bunch of smarty template files to a sub directory. When I issue git status it shows the new directories but also shows the old files deleted.

Is it safe to issue "git rm directory/oldfile.tpl" then "git add directory/directory2/newfile.tpl" ?
Git

Avatar of undefined
Last Comment
Robert Saylor

8/22/2022 - Mon
Jeff Darling

Do you see the new files that were created in the sub folder?

How did you perform the move?  Was it using git or command line move or windows explorer?

Is the history of the files prior to the move important to you?
Robert Saylor

ASKER
Yes, the new files are in the new folder. I manually moved them from the old location to the new location using the file system.

The files are stored on a linux server but I moved them via Mac finder on a mounted volume (remote web disk)

I will make a backup first before I commit just want clarification this is ok or is there a proper way to move files in a repository.
Robert Saylor

ASKER
oh, the history is not important on these files as there is minor or no change from the original. Was adding organization as I have too many template files already in my project.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
Jeff Darling

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Robert Saylor

ASKER
if I wanted to move a single file would it be:

git mv directory/filename.ext directory/directory2/filename.ext

?
Robert Saylor

ASKER
just a followup. I committed my changes this morning. I safely added the new directories and removed the old files that are no longer in the old directory. Git treated it as a rename. All is good.

I have some more files to organize this week so will give the git mv a try then.

My template directory was getting close to 50+ files so was making it hard to keep things straight.