How do you restructure working directory files in a git repository

0 votes
How do you restructure working directory files in a git repository?
Nov 26, 2019 in DevOps Tools by anonymous
• 19,610 points
2,893 views

1 answer to this question.

0 votes

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 ' 

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 create this restructuring permanently within 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 then commit command to create it permanently.

answered Nov 26, 2019 by anonymous
• 59,230 points

Related Questions In DevOps Tools

0 votes
0 answers

How do you restructure working directory files in a git repository?

How do you restructure working directory files ...READ MORE

Nov 26, 2019 in DevOps Tools by anonymous
• 19,610 points
471 views
+1 vote
1 answer

i have a pyhton code in my git/git repository how to build that code in jenkins

Follow these steps @Bhaskar: Step 1: Open the Jenkins ...READ MORE

answered Oct 14, 2019 in DevOps Tools by Kalgi
• 52,360 points
640 views
0 votes
1 answer

How do I find OpsWorks deploy user in a recipe ?

Here is a concept which you can ...READ MORE

answered Jul 25, 2018 in DevOps Tools by Atul
• 10,240 points
657 views
0 votes
3 answers
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,522 views
+2 votes
1 answer
0 votes
1 answer

How to get the current status of a local repository in Git?

Using 'git status' command in the repository ...READ MORE

answered Nov 26, 2019 in DevOps Tools by Sirajul
• 59,230 points
597 views
0 votes
1 answer

What are the steps to unstage files and discard changes in the working directory?

If the git status command displays 'myfile.txt' ...READ MORE

answered Nov 26, 2019 in DevOps Tools by Sirajul
• 59,230 points
1,710 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP