Categories

Feb 17 in Git
Q: How do you restructure the working directory files in git repository?

1 Answer

Feb 17
For example if we have a file called 'myfile.txt' to restructure/move in the sub directory 'mydir' under git's working directory; rather than cut and paste(manual mv command), we can use 'git mv <file-name> <target-dir-name>' e.g. 'git mv myfile.txt mydir'. This will move the file to provided directory and marks it to 'staging'. If we use 'git status' command now, it will display changes available to commit e.g. 'renamed: myfile.txt -> mydir/myfile.txt'. Now using git commit command make this restructuring permanently in the repository.

If we move file/folder out of the working directory (basically like permanently removing a committed file from the repository) then post movement we have to use 'git add -u' command to mark it staging and then commit command to make it permanently.
Click here to read more about GIT
Click here to read more about Insurance

Related questions

Madanswer
Sep 5 in Git
Oct 16, 2019 in Git
Oct 15, 2019 in Git
...